Mounting a chair - Tutorial
by Scott Peal · in Torque Game Engine · 01/27/2006 (9:37 am) · 9 replies
Does anyone know of a good tutorial for having a player mount a chair? If anyone wants to volunteer, I have a chair object in DTS/Milkshape with a mounting point to help out. It would be great if the tutorial was written against the Tutorial.Base example game.
About the author
Step 1) be the indie, step 2) make enough to buy a commercial license :)
#2
=> Chair.mountobject(player, node);
=> Chair.unmountobject(player);
Replace Chair with the ID of the chair. Replace player with the ID of the player. As the chair usually only has a single mount point put 0 in the node. However, putting 1, 2 and 3 mount point in the node seemed to work also.
Problem is it will mount the player standing on the chair, not sitting.
01/27/2006 (10:10 am)
I found that these console commands will mount and unmount the player from the chair:=> Chair.mountobject(player, node);
=> Chair.unmountobject(player);
Replace Chair with the ID of the chair. Replace player with the ID of the player. As the chair usually only has a single mount point put 0 in the node. However, putting 1, 2 and 3 mount point in the node seemed to work also.
Problem is it will mount the player standing on the chair, not sitting.
#3
Like this: mountPose[0] = "Sitting";
Or maybe just call player.setactionthread("Sitting") during the mounting process?
01/27/2006 (10:16 am)
Could you give the chair a mountPose like a vehicle?Like this: mountPose[0] = "Sitting";
Or maybe just call player.setactionthread("Sitting") during the mounting process?
#4
01/27/2006 (10:19 am)
Well the engine's not going to automatically pose your character for the appropriate situation. you have to create a "sitting" animation for your character. it doesn't have to be a full animation, you can just have the character sitting for one of the animation frames. re-export the character model with this new animation and call it from script when you want the character to sit. the only tricky part is that when an object is mounted onto something else, it's origin is attached to the node, so you need to make sure you match up the relative position of the origin with respect to the sitting character with how you want it attached to the node...if that makes any sense.
#5
One quick question: How do I reference the player(self, not others) and the chair from script if they were already included in a mission?
01/27/2006 (12:16 pm)
Thanks Scott & Sean. I thought the default character from the tutorial.base had the sitting animation already. I will try the chair in the car racing starter. I would think those characters have a sitting position in them?One quick question: How do I reference the player(self, not others) and the chair from script if they were already included in a mission?
#6
One quick question: How do I reference the player(self, not others) and the chair from script if they were already included in a mission?
01/27/2006 (1:36 pm)
Thanks Scott & Sean. I thought the default character from the tutorial.base had the sitting animation already. I will try the chair in the car racing starter. I would think those characters have a sitting position in them?One quick question: How do I reference the player(self, not others) and the chair from script if they were already included in a mission?
#7
check out the player.cs file. Theres some code in there for making the character sit in a vehicle. look at the
::onCollision(...) method for the player. there should be a place where it handles mounting to a vehicle. you might want to also look at the vehicle datablock to fully understand what's going on.
I havent worked with any recent versions of the script base so I may need correcting in case it's been changed since version 1.2.
01/27/2006 (2:07 pm)
Brian I thought you were using a character you created from scratch. youre right the default character does have a sitting animation.(at least I think it does) check out the player.cs file. Theres some code in there for making the character sit in a vehicle. look at the
::onCollision(...) method for the player. there should be a place where it handles mounting to a vehicle. you might want to also look at the vehicle datablock to fully understand what's going on.
I havent worked with any recent versions of the script base so I may need correcting in case it's been changed since version 1.2.
#8
01/30/2006 (6:17 am)
You can use the orc's sitting animation that's in starter.fps. Its the same skeleton so it should work with the tutorial.base character.
#9
I had mounted a player on a chair. but the problem is that the player is sitting at a certain height above the entire chair and not on the chair.
how to fix the player on the chair..?
Can you help me....
06/25/2010 (12:00 am)
Hi...I had mounted a player on a chair. but the problem is that the player is sitting at a certain height above the entire chair and not on the chair.
how to fix the player on the chair..?
Can you help me....
Torque 3D Owner Scott Peal
=> Chair.mountobject(player, node);
=> Chair.unmountobject(player);
Replace Chair with the ID of the chair. Replace player with the ID of the player. As the chair usually only has a single mount point put 0 in the node. However, putting 1, 2 and 3 mount point in the node seemed to work also.
Problem is it will mount the player standing on the chair, not sitting.