Jump to content

» «

Need Help With Placing Props (ScriptHookV.Net)

1 reply to this topic
  • JustSomeAussie

    Player Hater

  • Members
  • Joined: 20 Dec 2017
  • Australia


Posted 02 January 2018 - 12:40 AM Edited by JustSomeAussie, 02 January 2018 - 12:42 AM.

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

    Player Hater

  • Members
  • Joined: 13 Oct 2017
  • Germany


Posted 04 January 2018 - 02:08 PM

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