Picking Up an Object and Holding It?
by Bryan Edds · in Technical Issues · 01/05/2005 (3:02 pm) · 4 replies
I'm posting this on the forums because I have little experience with this particular part of Torque.
What I'm looking to do is to make a player charcter bend over and pick up an object, and keep that object in his hand until he lets it go (dropping it on the ground).
Now, I figure I'll be using the mountObject method, but I'm wondering how the 'slot' parameter works. Does each slot refer to a particula mounting point on the player? If so, is there a slot that refers to the hand? If not, can I build one?
That main thing I want to acheive is smooth animation as the player bends over to pick up the object, and runs around with it in his hand.
Is there a best way to acheive this preferably in script?
Thanks you so much for your time!
- Bryan Edds
What I'm looking to do is to make a player charcter bend over and pick up an object, and keep that object in his hand until he lets it go (dropping it on the ground).
Now, I figure I'll be using the mountObject method, but I'm wondering how the 'slot' parameter works. Does each slot refer to a particula mounting point on the player? If so, is there a slot that refers to the hand? If not, can I build one?
That main thing I want to acheive is smooth animation as the player bends over to pick up the object, and runs around with it in his hand.
Is there a best way to acheive this preferably in script?
Thanks you so much for your time!
- Bryan Edds
#2
When I mount any object to my player, I get 2 things -
1) While the mountObject method runs and returns success, it doesn't actually mount at all, and remains where it lay originally.
2) Now the engine is crashing on ShapeBase::unmountObject here -
- when the mission is exited.
This seems like odd behavior. Is part of the mounting feature broken in 1.3?
BTW, the same crash does NOT occur when I mount the player onto an object, but only happens when I try to mount an object on the player.
01/05/2005 (7:43 pm)
Well here's an odd thing -When I mount any object to my player, I get 2 things -
1) While the mountObject method runs and returns success, it doesn't actually mount at all, and remains where it lay originally.
2) Now the engine is crashing on ShapeBase::unmountObject here -
for(ShapeBase **ptr = & mMount.list; (*ptr); ptr = &((*ptr)->mMount.link) )
- when the mission is exited.
This seems like odd behavior. Is part of the mounting feature broken in 1.3?
BTW, the same crash does NOT occur when I mount the player onto an object, but only happens when I try to mount an object on the player.
#3
I'll post the solution later for all you forum searchers!
01/06/2005 (7:18 pm)
Problem solved! Thanks!I'll post the solution later for all you forum searchers!
#4
06/15/2005 (10:05 am)
Hi Bryan, can you post the solution since I am seeing this same error after using mountObject. The object doesn't render and it crashes in unmountObject. :-(
Associate Paul Dana
to make a mount point for the left hand you would create a node called mount1 (or mount2 etc...) and attach it to the end of the arm right where the hand is. Then use slot 1 (or slot 2 etc) when mounting from script.
doing the bend over animation will be a bit tricky because normally how the arms and head are oriented is controlled by the players "elevation angle". Making the chara bend over and pickup an item will involve setting a null "look" animation to keep the arms in a neutral positoin while the "bend over and pickup" animation runs. The bend over and pickup animatoin can be just another "action" animation that you define.
Good luck.