Mounted Objects with Collision?
by Will Sanders · in Torque Game Engine · 01/31/2003 (3:10 pm) · 5 replies
Does anyone have a clue as to how I could mount a simple object to a player and have it retain its collision?
#2
I could (and probably am) wrong. If you try it, could you post back here? lol, just so I know and don't have to do it myself when I get my computer fixed.
01/31/2003 (5:31 pm)
I don't have my code with me since my main computer took a dump (I'm using one made of spare parts that are all just laying on my desk, no case for me!). I think you can just mount an object to the player the same way you would with a vehicle. If I remember right, it's shapeBase that controls mounting, and players and vehicles are both derived from that.I could (and probably am) wrong. If you try it, could you post back here? lol, just so I know and don't have to do it myself when I get my computer fixed.
#3
Matt
02/01/2003 (1:51 pm)
I would think as long as the object has a collision in the model that collision would apply no matter whether its mount or not. If its a weapon there is an option to make it collidable but I think that only applies when the weapon is in sit&spin mode. Not sure though it might apply to either situation.Matt
#4
02/02/2003 (8:40 pm)
A weapon is just an image, not an actual object. I think he wants something with its own ID number. But I don't know, it's kind of vague.
#5
I think if you check pConvex->getObject()->getTypeMask() against StaticShapeObjectType then call getMountedObject(0) and compare that against pConvex->getObject(), then you can exclude mounted objects from the queing mechanism. There does not seem to be a test of this kind in place. I cannot quite pinpoint where to add a check.
I might be completely wrong, so you might try it and see what happens. I hope this thread's not too old.
05/22/2003 (5:29 pm)
You can mount a staticshape to the players hand, but when you do, the static shape will call its onCollision script method all the time. So, you can check if %obj is the mounted object, but there is some kind of static collision going on between the staticshape and the player when you do that so the player won't move forward. I think it has to do with collision masks and how StaticShapeObjectType is in sCollisionMoveMask and how this mask makes the the player class use a simple convex over say some of the more stringent collision tests.I think if you check pConvex->getObject()->getTypeMask() against StaticShapeObjectType then call getMountedObject(0) and compare that against pConvex->getObject(), then you can exclude mounted objects from the queing mechanism. There does not seem to be a test of this kind in place. I cannot quite pinpoint where to add a check.
I might be completely wrong, so you might try it and see what happens. I hope this thread's not too old.
Torque Owner Max Robinson
This would be a nice solution because you wouldn't have to make sure the object applies its colliding to the player, since the player owns the collision event.