Vehicles not saved in mission file?
by Stefan Beffy Moises · in General Discussion · 04/10/2002 (11:32 am) · 15 replies
Hi,
I got a pretty dumb question, probably... but if I add a vehicle (hover vehicle or boat) to a level with the level editor (and I changed some other object positions and some terrain, just to be sure) and I save the mission, the next time I load the mission all the changes are there, but the vehicles aren't ...
Any reason/explanation for that?
Thanks in advance!
I got a pretty dumb question, probably... but if I add a vehicle (hover vehicle or boat) to a level with the level editor (and I changed some other object positions and some terrain, just to be sure) and I save the mission, the next time I load the mission all the changes are there, but the vehicles aren't ...
Any reason/explanation for that?
Thanks in advance!
About the author
#2
04/10/2002 (12:23 pm)
Yes, you're right, they ARE in the mission file! I never realized that...But their posisiton is always set to 0:new FlyingVehicle() {
position = "0 0 0";
rotation = "1 0 0 0";
scale = "1 1 1";
dataBlock = "hoverVehicleTest";
disableMove = "0";
mountable = "1";
};Now I got five Vehicles in my mission file, all with the same values... does anyone have an explanation for this?
#3
04/10/2002 (12:25 pm)
search the forums for "vehicle" and you will find an explanation, I just forgot which thread it was in:)
#4
08/08/2002 (1:02 pm)
Stefan Did you find an answer to this? I'm having the same problem.
#5
08/10/2002 (2:02 am)
Yeah same?
#6
you have to spawn your vehicles just like the players on mission start!
At the moment, I'm simply spawning a vehicle with every player. I also use seperate vehicle spawn spheres (with a very small radius)...
I'm doing this in game.cs, createPlayer():
08/10/2002 (7:25 am)
Well, I still don't know the reason or solution, but I've got a workaround to offer...you have to spawn your vehicles just like the players on mission start!
At the moment, I'm simply spawning a vehicle with every player. I also use seperate vehicle spawn spheres (with a very small radius)...
I'm doing this in game.cs, createPlayer():
%defaultVehicle = new WheeledVehicle() {
dataBlock = "Buggy";
};
%pos = %player.getTransform();
%x = getWord(%pos, 0);
%y = getWord(%pos, 1);
%z = getWord(%pos, 2);
// use this to spawn at player location, maybe adjust the values slightly...
//%defaultVehicle.setTransform(%x @ " " @ %y @ " " @ %z);
// the parameter "2" tells the function that this is a vehicle
%defaultVehicle.setTransform(pickSpawnPoint(2));
%defaultVehicle.disableMove = "0";
%defaultVehicle.mountable = "1";
MissionCleanup.add(%defaultVehicle);I put a little switch in the pickSpawnPoint() function to distinguish between bots, players and vehicles:function pickSpawnPoint(%val)
{
if(%val == 1)
{
echo("AI is in the house...!");
%groupName = "MissionGroup/BotDropPoints";
}
else if(%val == 0)
{
%groupName = "MissionGroup/PlayerDropPoints";
}
else if(%val == 2)
{
%groupName = "MissionGroup/CarDropPoints";
}
%group = nameToID(%groupName);
...Hope this helps a bit... ;)
#7
You could use the TSStatic or StaticShape classes to place player "statues", but that won't work for a vehicles dts shapes designed to work with the Vehicle class (will be missing the wheels). Anyway, placing vehicles using anything other than the Vehicles classes will mean that they are not controllable.
Saving Vehicles could be cool, especially if there are only a fixed number of vehicles in a mission, all pre-placed by the mission designer. I'll post a task in the project manager.
08/10/2002 (10:02 am)
The Vehicle class (along with the Player and Camara classes) were only setup to be dynamic objects, they weren't designed to be stored off into a mission. It probably wouldn't be hard to fix.You could use the TSStatic or StaticShape classes to place player "statues", but that won't work for a vehicles dts shapes designed to work with the Vehicle class (will be missing the wheels). Anyway, placing vehicles using anything other than the Vehicles classes will mean that they are not controllable.
Saving Vehicles could be cool, especially if there are only a fixed number of vehicles in a mission, all pre-placed by the mission designer. I'll post a task in the project manager.
#8
Ok simple the SceneObject has the proper Transform ..
simply extract that from there and assign it to your
next to be used rigid state
the Vehicle loads fine.
08/11/2002 (3:11 pm)
Edit: Ok simple the SceneObject has the proper Transform ..
simply extract that from there and assign it to your
next to be used rigid state
the Vehicle loads fine.
bool Vehicle::onAdd()
{
....
Point3F pos=getPosition();
QuatF rot;
rot.set(mObjToWorld);
mRigid.state.linPosition=pos;
mRigid.state.angPosition=rot;
mDelta.rot[1] = mDelta.rot[0] = mRigid.state.angPosition; // <--- Already There
....
#9
You just have to make sure you got
Sweet!! :D
10/20/2002 (1:24 am)
thx again, badguy, works like a charm!! :)You just have to make sure you got
%obj.mountable = true;in you "onAdd()" script function so that you can mount/use it...
Sweet!! :D
#10
add functionality for the mountable variable in the onMount and doDismount for player
so that your ai dont jump in your seat and take over your ride
.. Logic later for more seats as the art develops :)
10/20/2002 (1:33 am)
heh sure while we are putting that to use ..add functionality for the mountable variable in the onMount and doDismount for player
so that your ai dont jump in your seat and take over your ride
.. Logic later for more seats as the art develops :)
#11
10/20/2002 (1:55 pm)
Ok the Patch is Submitted .. hopefully it can make it into the head.
#12
01/28/2003 (8:16 am)
I don't understand why this never made it into the head. Could you try again Badguy to get it in, I know it's a easy fix, but I see others having this problem and finding the fix sometimes takes a while with the non-context searches.
#13
edit - damn IE
02/06/2003 (6:15 am)
Just to let people know this needs to be updated to work with the current HEAD. rigid.cc was changed so here's what you'll need to add in vehicle.cc now:bool Vehicle::onAdd(){
....
Point3F pos=getPosition();
QuatF rot;
rot.set(mObjToWorld);
mRigid.linPosition=pos;
mRigid.angPosition=rot;
mDelta.rot[1] = mDelta.rot[0] = mRigid.angPosition; // <--- Already Thereedit - damn IE
#14
02/06/2003 (1:54 pm)
Just fixed this in the HEAD revision, but only tested it with the wheeled vehicles. Thanks guys!
#15
02/06/2003 (5:37 pm)
Great Tim! This had to be on head. Thanks.
Torque Owner Stefan