» «

# Airbrake creation problems

2 replies to this topic
formel117
• ##### formel117

Player Hater

• Members
• Joined: 13 Jun 2013

### #1 Posted 13 June 2013 - 12:35 PM

Hello. I've been trying to create Airbreak in my mod for a while now, and I've come across a problem with it.
When "going forward" it also goes upwards/downwards depending on if I'm in a vehicle and what vehicle it is, and if I'm on foot.

I've tried searching both here and on Google for examples on Airbrake but I can't seem to find any at all.

 CODE double h = ((Math.PI * (Player.Character.Heading + 92)) / 180);                    float Z = Player.Character.Position.Z; // used to calculate difference in the Z coordinate afterwards                    Vector3 direction = new Vector3(((float)Math.Cos(h)) * 6, ((float)Math.Sin(h)) * 6, -1.0f);                    if (Player.Character.isInVehicle())                    {                        Player.Character.CurrentVehicle.Position += direction;                    }                    else                    {                        Player.Character.Position += direction;                    }                    float za = Player.Character.Position.Z - Z;                    if (Player.Character.isInVehicle())                        Player.Character.CurrentVehicle.Position -= new Vector3(0, 0, za);                    else                        Player.Character.Position -= new Vector3(0, 0, za);

I've tried doing a lot of things differently, but I'm just more confused now. Anybody feel like helping?

julionib
• ##### julionib

Coder

• Feroci
• Joined: 13 Sep 2012

### #2 Posted 13 June 2013 - 04:10 PM

i dont know if im saying bullsh*t here but and if you increase player position with his direction and when in a car increase car position with car direction with Z set to 0 before increment?

sorry if i misunderstood your problem/question

formel117
• ##### formel117

Player Hater

• Members
• Joined: 13 Jun 2013

### #3 Posted 14 June 2013 - 04:30 AM

 QUOTE (julionib @ Thursday, Jun 13 2013, 16:10) i dont know if im saying bullsh*t here but and if you increase player position with his direction and when in a car increase car position with car direction with Z set to 0 before increment?sorry if i misunderstood your problem/question

I fixed the problem. Here's the code for going forwards

 CODE float z = Player.Character.Position.Z;                    Vector3 move = ((new Vector3(Player.Character.Direction.X, Player.Character.Direction.Y, 0) * 3));                    Player.Character.Position += move;                    Player.Character.Position -= new Vector3(0, 0, (Player.Character.Position.Z - z)*2);                    float difference = (Player.Character.Position.Z - z); // Always 0

#### 1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users