IMG

 
IMG
IMG   IMG
  Welcome to GTAForums! Be sure to check out the Grand Theft Auto V Forum.

You are not registered! (If you are, click here to login) Registering is fast, free and easy and allows you to instantly reply to any topic on GTAForums.
Why wait? Click here to register your own unique username and become part of the ever-growing community!


( Log In | Register | Revalidate Validation E-mail )
Quick Log-In:
  IMG
       
>
Forum Rules GTA Modification Forums

Post mod/code requests in the Mod Requests topic

Post mod releases in the Mod Showroom

Read the Modding Rules BEFORE posting!

GTAGarage.com
free mod hosting from GTANet, simply login with your GTAForums account details

GTAModding.com
GTANet's modding wiki

GTA Modding Chatroom
provided by irc.gtanet.com (Don't have an IRC client? Click here)


  Reply to this topicStart new topicStart Poll

 GetVehicleQuaternion Problem

 Normal usage crashes game?
 
nixolas1  
Posted: Sunday, Jul 1 2012, 12:28
Quote Post


Creator/Destroyer
Group Icon
Group: Members
Joined: Dec 23, 2008

XXXXX



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.
PM
  Top
 

 
Deluxe8900  
Posted: Sunday, Jul 1 2012, 13:31
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jun 14, 2012

XXXXX



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 tounge.gif But good luck hope this helps smile.gif

Also pm me I have a request for you smile.gif

This post has been edited by Deluxe8900 on Sunday, Jul 1 2012, 13:44
PM
  Top
 

 
nixolas1  
Posted: Sunday, Jul 1 2012, 19:16
Quote Post


Creator/Destroyer
Group Icon
Group: Members
Joined: Dec 23, 2008

XXXXX



hmm, you have some strange SetVehicleQuaternion functions there, u sure all of them ain't just SA?
cause in iv the first var is vehicle, then 4 rot vars.
PM
  Top
 

 
nixolas1  
Posted: Tuesday, Jul 3 2012, 13:14
Quote Post


Creator/Destroyer
Group Icon
Group: Members
Joined: Dec 23, 2008

XXXXX



lol, figured it out, seems i just messed up func def. solved.
PM
  Top
 

 

1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)

0 Members:

Topic Options Reply to this topicStart new topicStart Poll
Search topic for posted by (exact match)



 
IMG IMG