GTA Modification Forums
GetVehicleQuaternion Problem Normal usage crashes game?
 |
|
 |
| |
nixolas1  |
|
Creator/Destroyer

Group: Members
Joined: Dec 23, 2008

|
Hey fellow coders, Ive been trying to save the vehicle quaternion (advanced rotation position) with code similar to this: | CODE | f32 X,Y,Z,W; Ped ped;
Player playerIndex = ConvertIntToPlayerIndex(GetPlayerId()); GetPlayerChar(playerIndex, &ped);
if (IsCharInAnyCar(ped)) { PrintStringWithLiteralStringNow2("STRING", "Trying", 1000, 1); GetCarCharIsUsing(ped, &veh); GetVehicleQuaternion(veh, &X, &Y, &Z, &W); SetVehicleQuaternion(veh, X,Y,Z,W); PrintStringWithLiteralStringNow2("STRING", "Success!", 1000, 1); } |
but my game crashes just by using any of the quaternion functions. any ideas why, have you used it before? anything im doing wrong? It's for a almost-finished project i have, a time-control mod where u can go back in time.
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
Deluxe8900  |
|
Player Hater

Group: Members
Joined: Jun 14, 2012

|
| QUOTE (nixolas1 @ Sunday, Jul 1 2012, 12:28) | Hey fellow coders,
Ive been trying to save the vehicle quaternion (advanced rotation position) with code similar to this:
| CODE | f32 X,Y,Z,W; Ped ped;
Player playerIndex = ConvertIntToPlayerIndex(GetPlayerId()); GetPlayerChar(playerIndex, &ped);
if (IsCharInAnyCar(ped)) { PrintStringWithLiteralStringNow2("STRING", "Trying", 1000, 1); GetCarCharIsUsing(ped, &veh); GetVehicleQuaternion(veh, &X, &Y, &Z, &W); SetVehicleQuaternion(veh, X,Y,Z,W); PrintStringWithLiteralStringNow2("STRING", "Success!", 1000, 1); } |
but my game crashes just by using any of the quaternion functions. any ideas why, have you used it before? anything im doing wrong?
It's for a almost-finished project i have, a time-control mod where u can go back in time. |
I done something with this ages ago for GTAIV/SA: | CODE | | SetVehicleQuaternion(0.0,0.0,0.0,1.0); |
| CODE | SetVehicleQuaternion(float x,float y,float z,float s) { *(FLOAT*)(c_player_struct + CPlayerInCarSyncOffset + offsetof(InCarSync,QuaternionX)) = x; *(FLOAT*)(c_player_struct + CPlayerInCarSyncOffset + offsetof(InCarSync,QuaternionY)) = y; *(FLOAT*)(c_player_struct + CPlayerInCarSyncOffset + offsetof(InCarSync,QuaternionZ)) = z; *(FLOAT*)(c_player_struct + CPlayerInCarSyncOffset + offsetof(InCarSync,QuaternionScal)) = s; |
| CODE | | SetVehicleQuaternion(0.0,0.0,Grad2Roll(t_z),0.0); |
| CODE | | SetVehicleQuaternion(CurrentBlockInCarData.QuaternionX,CurrentBlockInCarData.QuaternionY,CurrentBlockInCarData.QuaternionZ,CurrentBlockInCarData.QuaternionScal); |
| CODE | | SetVehicleQuaternion(t_car, data->angle[0], data->angle[1], data->angle[2]); |
This is all I have laying around on my PC, don't know if anything will work some code is from SA & other is from GTAIV, but I am not sure, you can figure that out which one is which game haha  But good luck hope this helps  Also pm me I have a request for you This post has been edited by Deluxe8900 on Sunday, Jul 1 2012, 13:44
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:
Track this topic
Receive email notification when a reply has been made to this topic and you are not active on the board.
Subscribe to this forum
Receive email notification when a new topic is posted in this forum and you are not active on the board.
Download / Print this Topic
Download this topic in different formats or view a printer friendly version.
| |
 |
|
 |
|