Quantcast

Jump to content

» «
Photo

Need Help With Placing Props (ScriptHookV.Net)

1 reply to this topic
JustSomeAussie
  • JustSomeAussie

    Player Hater

  • Members
  • Joined: 4 weeks ago
  • Australia

#1

Posted 3 weeks ago Edited by JustSomeAussie, 3 weeks ago.

Okay so i'm working on a mod and i need to place a fire model "prop_beach_fire" in front of the player and on the ground. I can place it in front of me easily, but i can't seem to get to to actually touch the group. Here's my code:

 

            Ped player = Game.Player.Character;

            GTA.Math.Vector3 spawnLoc = player.Position + (player.ForwardVector * 5);
 
            GTA.World.CreateProp("prop_beach_fire", spawnLoc, false, true);
 
If anyone knows how to place it on the ground please let me know.

blo0oddrunk
  • blo0oddrunk

    Player Hater

  • Members
  • Joined: 13 Oct 2017
  • Germany

#2

Posted 2 weeks ago

You could try using World.GetGroundHeight(Vector2/Vector3) to find the Z coordinate

 

I'm not sure how exact that value is. 

 

Maybe it has some constant offset by which you have to decrease the Z value.

Vector3 spawnLoc = player.Position + (player.ForwardVector *5);
spawnLoc.Z = World.GetGroundHeight(spawnLoc);

World.CreateProp("prop_beach_fire", spawnLoc, false, true);

Also as a hint: When you use "using" at the beginning of your code you can save some time writing.

 

Start the first lines of your projects with "using GTA;" and "using GTA.Math;" so you can just call Vector3 instead of GTA.Math.Vector3





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users