Jump to content

Recommended Posts

Posted

I noticed that scaling down players in torquescript made them fall through the terrain constantly.

I changed this

Point3F Player::_move( player.cpp around line 4670 ) {
....
if (mFabs(distance.x) < mObjBox.len_x() &&
   mFabs(distance.y) < mObjBox.len_y() &&  
   mFabs(distance.z) < mObjBox.len_z())  
{ 

to this

if (mFabs(distance.x) < mScaledBox.len_x() &&  
  mFabs(distance.y) < mScaledBox.len_y() &&  
  mFabs(distance.z) < mScaledBox.len_z())  
{ 

and the problems stopped.

I don't know if this is something I should make a PR for, and I am not good enough with C++ or the engine to know if there is a better way to solve the problem, so I am bringing it up here.

Posted

How did you change the scale? When you change it manually it works, the problem is, for the moment the change is happening the collision is disabled and the player may fall through, like if you change the size of an object you stand on, or scale yourself.

Posted

I used the editor to change the scale. The player never dropped through the terrain when doing that, but after it fell for a short distance it would punch right through.

Posted

What I found is, that the physics engine needs some kind of tolerance for collisions.

In datablocks they are named "collisionTol" and "contactTol" , so maybe if you scale the player it's tolerance gets too small and so sometimes falls through.

Posted

Maybe it has something to do with the tolerance, maybe it doesn't, I don't know enough about the collision system to say. The changes I made do seem to work however, the default soldier still works fine even when scaled to 1/20th of his original size.

Posted

The change you made is correct as far as I can see - before the player's collision box wasn't scaled with the player model, now it is. This filter using a scaled player collision box makes sense.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...