UGX-Mods

Call of Duty: Black Ops 3 => Help Desk => Scripting => Topic started by: Sxmplicity on October 18, 2016, 01:28:09 pm

Title: Add gravity to a model? (Make it fall to the ground)
Post by: Sxmplicity on October 18, 2016, 01:28:09 pm
Hi!

So I am currently trying to work out how to make it so a script_model which I spawn via my GSC file can fall to the ground. At the moment I am spawning the model above the ground to allow it room to obviously fall down, but as you probably know when a model has an origin set, it will stick to that origin and float in the air. Is there a way to make it so the model's which I spawn fall to the ground instead of floating?

My code:
Code Snippet
Plaintext
function spawnStartingWeapons()
{
startWeap = GetEnt("weaponSpawner_1", "targetname");

for(guns = level.playerCount; guns > 0; guns--)
{
randomPosX = RandomIntRange(-150, 150);
randomPosY = RandomIntRange(-150, 150);
randomPosA = RandomIntRange(45, 120);
level.startWeaps[guns] = spawn("script_model", startWeap.origin + (randomPosX, randomPosY, 0));
level.startWeaps[guns] setModel("t6_wpn_pistol_m1911_world");
level.startWeaps[guns].angles = (0, 0, randomPosA);
}
}

And also another question (if you know it, that'll be great), I am unable to find any models which is a weapon model (as all the models I have copied the name from Radiant and put it in the script end up just being boxes?)

Thanks in advance!
Title: Re: Add gravity to a model? (Make it fall to the ground)
Post by: ulraz_viper on October 18, 2016, 09:44:07 pm
You would maybe need to add a custom animation for this.. unless you set its final origin pos to the position laid on the ground