Props keep spawning on the ground
When i spawn a prop no matter what it keeps spawning on the ground. I tried disabling collision, gravity and freezing its position. I tried increasing its spawn height but nothing, any ideas as to what causes this issue?
@M8T post your code.
keypadconud = World.CreateProp("ch_prop_fingerprint_scanner_01c", new Vector3(12.0333f, -668.5653f, 37.8402f), new Vector3(0F, -0f, 3.4698F), true, true);
keypadconud.HasCollision = false; keypadconud.HasGravity = false;
@M8T You don't need to play with the collision, or freeze, or gravity. Your coordinates sent me into a freefall through the map, so I put in my own. You can change them back but they go nowhere when I used them in Menyoo (Menyoo doesn't have the same coords as a script).
Vector3 myPos = new Vector3(-1330f, -3033.5653f, 11.8402f);
var myProp = World.CreateProp("ch_prop_fingerprint_scanner_01c", myPos, new Vector3(0f, 0f, 3.4f), false, false);
myProp.PositionNoOffset = myPos;
@M8T Thanks now it works! Your a life saver all the time haha!
@M8T You're welcome. Unfortunately I'm not a programmer so my help here is limited. I'm better at fixing games that crash.
I was tired when I posted so I just recycled some code I used when I first started. This was my first scripting question. I was helped on this one, and a few other important coding challenges by @Jitnaught .
You can do what you want by setting the last parameter, or both booleans to false. One is to place object on ground when true, the other is for dynamic status.
You had set them to true, which is the default. So only one line of code is required. The extra line of code I had is because I was replacing an object by script that i had created in Menyoo with the spooner. The coordinates for Menyoo, in this case for Z, were not the same as my script values, so the script adjusted for that difference.
public static Prop CreateProp(Model model, Vector3 position, Vector3 rotation, bool dynamic, bool placeOnGround)