vehicles
by Travis Vroman · in General Discussion · 07/21/2002 (9:45 am) · 18 replies
anybody know what I would need to do to enter a vehicle by pressing enter when standing near it? Any help would be appreciated. Thanks in advance.
-Barzahd
-Barzahd
#2
%col.mountObject(%obj,%node);
This is the code to mount an object,
so %col is the object u are mounting
and %obj is what is mounting it so the player...
and %node is where to mount the obj to...
Look inside the player.cs file
What i would think about doing is just add a Var in this function here: Armor::onCollision(%this,%obj,%col)
and then when the player Presses Enter just run threw that line of code above to mount him to the vehicle.. of course u need to add some code so when the player moves away from the vehicle the var sets back to its orginal val.
just an example, might not be the best way tho.. but is the easyest...
08/15/2002 (1:30 pm)
%node = 0;%col.mountObject(%obj,%node);
This is the code to mount an object,
so %col is the object u are mounting
and %obj is what is mounting it so the player...
and %node is where to mount the obj to...
Look inside the player.cs file
What i would think about doing is just add a Var in this function here: Armor::onCollision(%this,%obj,%col)
and then when the player Presses Enter just run threw that line of code above to mount him to the vehicle.. of course u need to add some code so when the player moves away from the vehicle the var sets back to its orginal val.
just an example, might not be the best way tho.. but is the easyest...
#3
08/15/2002 (1:34 pm)
What about using a keypress to trigger some code that determines the nearest vehicle and vehicle node, and then attempts to automatically mount the vehicle at that node?
#4
08/15/2002 (1:39 pm)
yeah that's what i was thinking, but that would take a lot of coding, and i don't really have to much time to code something like that. Personaly i like the way it is
#5
I plan to work on it if not...
Let me know if you found anything out on it at all..
TGE - Vehicles (TGEV)
TGEV - Yahoo Group
10/07/2002 (8:40 am)
Did you ever get anywhere with this?I plan to work on it if not...
Let me know if you found anything out on it at all..
TGE - Vehicles (TGEV)
TGEV - Yahoo Group
#6
12/01/2003 (6:31 pm)
I just put a flying vehicle and a wheeled vehicle in one of my mods. I am having problems with the type of mounting. The vehicles that I put in are both motor cycles. When he mounts the bikes he is not in a riding position. I have try changing the mount position to sitting, riding, and driving. But they do not work is there some other problem that I may have.
#7
Just issues a commandToServer on whatever key press. Simple and clean.
12/02/2003 (4:36 am)
I used this with success in Tribes 2 with serveral mods.function serverCmdMountVehicle(%client)
{
%player = %client.player;
if(!isObject(%player))
return;
%scEyeVec = VectorScale(VectorNormalize(%player.getEyeVector()), 25.0);
%eyeEnd = VectorAdd(posFromTransform(%player.getEyeTransform()), %scEyeVec);
%rot = rotFromTransform(%player.getTransform());
%searchResult = containerRayCast(posFromTransform(%player.getEyeTransform()), %eyeEnd, $TypeMasks::VehicleObjectType, 0);
if(%searchResult)
{
messageClient( %client, 'MsgMountSuccess', '\c2Auto mounting %1.', %searchResult.getDataBlock().getName() );
%player.setImageTrigger(0, false);
%player.getDataBlock().onCollision(%player, %searchResult, 0);
return;
}
else
{
messageClient( %client, 'MsgMountFailed', '\c2No vehicle in 25 meter range.' );
}
}Just issues a commandToServer on whatever key press. Simple and clean.
#8
I hope that I am clear in what I am trying to say. Sorry if not.
Thanks for the help,
Zo
12/03/2003 (10:05 am)
This will help the character be drive the motor cycle in a riding position. B/c my proble is when he is standing his legs are hanging down to far and when he is sitting he sits in side th motorcycle in the middle where the engine is. While this code help fix this problem if it will, where do I put it.I hope that I am clear in what I am trying to say. Sorry if not.
Thanks for the help,
Zo
#9
12/03/2003 (12:40 pm)
The mount point node for the model is not in the correct position. This is why the player model is not lined up correctly. There is nothing that can be done via script to fix it, you must fix the models mount point and re-export it.
#10
12/03/2003 (3:10 pm)
Also the sitting position for a motercycle has a different angle, try rotating the "pivot point only" of the mount node to suit along the correct axis, basicaly as Ralph says your problem is within the model, it requires adjusting and re exporting, it also sounds like the model needs re-scaling.
#11
12/03/2003 (3:35 pm)
Zib have you tried this awesome tutorial here? It seems like it has everything you need
#12
rotFromTransform and posFromTransform are unknown functions with my version (based off of 1.2)
Know where these functions should be at?
12/03/2003 (5:01 pm)
Ralph-rotFromTransform and posFromTransform are unknown functions with my version (based off of 1.2)
Know where these functions should be at?
#13
function posFromTransform(%transform)
{
// the first three words of an object's transform are the object's position
%position = getWord(%transform, 0) @ " " @ getWord(%transform, 1) @ " " @ getWord(%transform, 2);
return %position;
}
function rotFromTransform(%transform)
{
// the last four words of an object's transform are the object's rotation
%rotation = getWord(%transform, 3) @ " " @ getWord(%transform, 4) @ " " @ getWord(%transform, 5) @ " " @ getWord(%transform, 6);
return %rotation;
}
12/03/2003 (5:53 pm)
Those are just some simple little functions to pull the desired numbers from transforms...function posFromTransform(%transform)
{
// the first three words of an object's transform are the object's position
%position = getWord(%transform, 0) @ " " @ getWord(%transform, 1) @ " " @ getWord(%transform, 2);
return %position;
}
function rotFromTransform(%transform)
{
// the last four words of an object's transform are the object's rotation
%rotation = getWord(%transform, 3) @ " " @ getWord(%transform, 4) @ " " @ getWord(%transform, 5) @ " " @ getWord(%transform, 6);
return %rotation;
}
#14
The wheel spends as if the pivot point if on top of the tire.
Thanks for all the help
12/04/2003 (3:32 pm)
I fixed the problem with the vehicles. I was not turning the trasnforms off before porting the objects. But know I am having another problem with the wheels. I did the wills my self, and everytime I put the bike and the wheels together the pivot point it wrong. I have check all of the pivot points on the wheel object and they are all in the center.The wheel spends as if the pivot point if on top of the tire.
Thanks for all the help
#15
12/04/2003 (7:24 pm)
Make sure the the pivot point of the Bounds box is centered.
#16
Thanks for all the help. I hope to post a link to my web site when I get everything up and running.
12/04/2003 (10:01 pm)
Thanks all that did the trick. In stud of using the pivot point center tab in max I used the hierachy tab. To change the pivot.Thanks for all the help. I hope to post a link to my web site when I get everything up and running.
#17
I am using the latest head. I have tried the 'awesome tutorial here' are recomended by Britton, and that didn't work at all. The keypresses didn't work, i could not create a vehicle and i could not enter it.
I have tried bravetree's carpack pro and i can create a vehicle with CTRL-D but i cannot even enter it with collision.
I am trying to achieve the same result here as other people, hit a key enter a vehicle, and exit a vehicle on key press too.
05/27/2004 (4:45 am)
I am at my wits end.I am using the latest head. I have tried the 'awesome tutorial here' are recomended by Britton, and that didn't work at all. The keypresses didn't work, i could not create a vehicle and i could not enter it.
I have tried bravetree's carpack pro and i can create a vehicle with CTRL-D but i cannot even enter it with collision.
I am trying to achieve the same result here as other people, hit a key enter a vehicle, and exit a vehicle on key press too.
#18
www.gamebeavers.org
www.gamebeavers.org/modules.php?op=modload&name=Downloads&file=index&req=getit&l...
07/06/2004 (6:57 pm)
You can download a working example from the gamebeavers site here:www.gamebeavers.org
www.gamebeavers.org/modules.php?op=modload&name=Downloads&file=index&req=getit&l...
Associate Anthony Rosenbaum
dunno any other way