Jump to content

A quick question about collide


Jason Campbell

Recommended Posts

This is strange, I added this to vehicleWheeled.cs in scripts/server to see what was happening and it only registers if I hit AIPlayer, Bouncy Rocks, AITurrets but not TSStatic shapes. I'll keep looking into this, I hope tonight.

 

function WheeledVehicleData::onCollision(%this, %obj, %col, %vec, %speed)
{
  // Collision with other objects, including items
  echo("car collision:",%col.getName());
}

Link to comment
Share on other sites

TSStatic is a StaticShapeObjectType, so that mask should detect it.

https://github.com/GarageGames/Torque3D/blob/development/Engine/source/T3D/tsStatic.cpp#L108.


Edit: And it does, but LukasPJ is correct. Apparently it was decided that Vehicles should only generate collision callbacks for ShapeBase derived objects.

https://github.com/GarageGames/Torque3D/blob/development/Engine/source/T3D/vehicles/vehicle.cpp#L1415-L1419

https://github.com/GarageGames/Torque3D/blob/development/Engine/source/T3D/vehicles/vehicle.cpp#L1610-L1624

You could make your rocks StaticShape instead of TSStatic and get the callbacks.

Link to comment
Share on other sites

I just tried to get StaticObjectType added to the mask. I added it and included tsStatic.h and it compiled without errors but still did not detect TSStatic on collision.


Think it was removed because TSStatics are just supposed to sit there.


@OTHGMars: probably that is the answer, using StaticShapes. OP could also mess about with Rigid Shapes and applyImpulse to the collision for some simple movement stuff.

Link to comment
Share on other sites

  • 4 months later...

What happens when you have a large city? I thought TSstatic was made to avoid all the overhead of the staticshape. I have vehicles crashing into buildings all over. My quick temporary fix


function PickupTruck::onImpact(%this, %obj, %col,%vec,%vecLen)

{

echo("IMPACT "@%obj SPC %col SPC %vecLen);

}


%vecLen does give me a value so I use that to put damage on the truck...

Link to comment
Share on other sites

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...