Placement of vehicle moves when map are saved ?
by Billy L · in Torque Game Engine · 01/27/2003 (3:29 pm) · 8 replies
Hi all !
I started todo some vehicles but when i place them on a map
and save and reload it again then position of the vehicle is changed ,and its far away from the orignal position !????
I tried this in the head build to ,i took the buggy from the racing mod and loaded it into the fps and saved and i got same thing !!!! ???????
So help or give me a hint !
Greetings
Billy
I started todo some vehicles but when i place them on a map
and save and reload it again then position of the vehicle is changed ,and its far away from the orignal position !????
I tried this in the head build to ,i took the buggy from the racing mod and loaded it into the fps and saved and i got same thing !!!! ???????
So help or give me a hint !
Greetings
Billy
#2
for the record, I use the technique Tim suggests.
01/27/2003 (7:10 pm)
from this thread: www.garagegames.com/index.php?sec=mg&mod=forums&page=result.thread&qt=3610 (near the bottom)Quote:
Tim Gift
Employee Posted: Mar 04, 2002 12:27 EST
Richard... many of the client control objects aren't setup to be saved with the mission, I believe this includes the player. They were just never designed that way, it's way they initialize themselves from the saved properties. I'm sure this can be corrected, but it would not be high on my list right now, CGDC is comming up quick and I have a few things on my plate for that.
You can either look at the code (might be a little tricky to sort through), or you could try putting a little script loop in start game that puts a vehicle at all the markers in a group. That way you just place markers in the editor.
for the record, I use the technique Tim suggests.
#3
Do you have an example on your script ?
That i realy would like to have is spawnpoints where i can choose
what to spawn !
Greetings
Billy
01/28/2003 (3:38 am)
Hi Ken !Do you have an example on your script ?
That i realy would like to have is spawnpoints where i can choose
what to spawn !
Greetings
Billy
#4
mission file entry:
01/28/2003 (6:18 am)
spawn code:function AddVehicles()
{
%group = nameToID("MissionGroup/VehicleEntryPoints/TruckEntryPoints");
if (%group != -1 )
{
%index = 0;
%count=%group.getCount();
for ( %index = 0; %index < %count; %index++)
{
%spawn = %group.getObject(%index);
%vehicle = new WheeledVehicle()
{
dataBlock = LandRover;
};
%vehicle.index = %index;
%vehicle.salvageDelay = %spawn.salvageDelay;
%vehicle.mountable = true;
%vehicle.setTransform( %spawn.getTransform() );
MissionCleanup.add(%vehicle);
}
}
// add other vehicle types, or use above in a loop
}mission file entry:
new SimGroup(VehicleEntryPoints) {
new SimGroup(SkateboardEntryPoints) {
};
new SimGroup(ZodiacEntryPoints) {
};
new SimGroup(TruckEntryPoints) {
new SpawnSphere() {
position = "-32.8568 27.8346 204";
rotation = "0 0 -1 10.3133";
scale = "1 1 1";
dataBlock = "SpawnSphereMarker";
Radius = "1";
sphereWeight = "10";
indoorWeight = "10";
outdoorWeight = "10";
salvageDelay = "10000";
};
};
new SimGroup(ChopperEntryPoints) {
};
new SimGroup(BalloonEntryPoints) {
};
new SimGroup(TankEntryPoints) {
};
new SimGroup(WagonEntryPoints) {
};
new SimGroup(BuggyEntryPoints) {
};
new SimGroup(FerryEntryPoints) {
};
};
#5
Thanks to badguy who posted this in some thread I can't find anymore,
here is the fix for "vehicle.cc":
change the "onAdd()" function to start like this:
01/28/2003 (7:09 am)
How about fixing the code to restore the positon correctly instead? ;)Thanks to badguy who posted this in some thread I can't find anymore,
here is the fix for "vehicle.cc":
change the "onAdd()" function to start like this:
bool Vehicle::onAdd()
{
if (!sVehicleCount++)
sPolyList = new ClippedPolyList;
if (!Parent::onAdd())
return false;
// added by beffy to restore the correct position according to the mission file...
// thx to badguy
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;
mDelta.pos = mRigid.state.linPosition;
mDelta.posVec = Point3F(0,0,0);
...
#6
01/28/2003 (8:13 am)
The fix works great that Badguy posted!
#7
Why dont put this in the head ?
So little code but so great !
Thx
You are super guys !
Greetings
Billy
01/28/2003 (12:20 pm)
WOW This is great!Why dont put this in the head ?
So little code but so great !
Thx
You are super guys !
Greetings
Billy
#8
sweet...
now for unmounting with a key bind.. : )
has a code like that been made for dismounting?
right now it mounts when you run into the vehicle.. but all space bar does is rotate the player inside the vehicle.. : )
still alot of fun.. : )
01/28/2003 (1:44 pm)
Worked like a charm.. :)sweet...
now for unmounting with a key bind.. : )
has a code like that been made for dismounting?
right now it mounts when you run into the vehicle.. but all space bar does is rotate the player inside the vehicle.. : )
still alot of fun.. : )
Torque 3D Owner Tom Feni
My buggy was 100,000 mtrs down before I realized what was wrong.. for some reason it doesnt respawn in the spot i placed it.. : )
I know nada as far as getting it to stay put, I think you may have to use a vehicle station type system to call vehicles to spawn.. I will watch and see if someone has an answer because I am also trying to do this very thing.. : )