UGX-Mods

Call of Duty 5: World at War => Help Desk => Scripting => Topic started by: Gabrielle on October 09, 2015, 10:07:05 pm

Title: Spawn model walkable
Post by: Gabrielle on October 09, 2015, 10:07:05 pm
I finally managed to spawn a model in-game (for spawning perks in existing maps) but I can walk through them.

I now got:

Code Snippet
Plaintext
model = spawn("script_model", (-158.182, -294.875, 1.125));
model.angles = (0, 180, 0);
model setmodel("zombie_vending_revive");

But I can walk through the perk. How can I make it so you can't walk through it?
Title: Re: Spawn model walkable
Post by: DidUknowiPwn on October 09, 2015, 10:19:26 pm
Use a collision model and link it to your model.

"collision_xxxxx" in xmodel
Title: Re: Spawn model walkable
Post by: Gabrielle on October 09, 2015, 10:21:48 pm
Use a collision model and link it to your model.

"collision_xxxxx" in xmodel

How do I link it? And if I spawn the collision model won't the same thing happen?
Title: Re: Spawn model walkable
Post by: DeletedUser on October 09, 2015, 10:27:00 pm
Use a collision model and link it to your model.

"collision_xxxxx" in xmodel
if hes only just found out how to spawn in models wont it be best to give him the spawn collision function?

anyways JoshZombieBoy use this function to spawn in collisions and make perks collidable

Code Snippet
Plaintext
/*
all 4 arguments are required but the second one must be "collider"

collision_model can be any collision model (collision_geo_X in assviwer)
origin is the location to spawn at
angles is the angles to rotate the collision entity to

would be best used like this

spawnCollision(<collision_model>, "collider", model.origin, model.angles);
*/

collision = spawnCollision(<collision_model>, "collider", <origin>, <angles>);

Double Post Merge: October 09, 2015, 10:28:57 pm
How do I link it? And if I spawn the collision model won't the same thing happen?

Code Snippet
Plaintext
collision = spawnCollision(<collision_model>, "collider", <origin>, <angles>);

the collision entity returned is like any other entity just call LinkTo(<parent>); on the collsion and it will be linked to it (have same origin and angles (with a offset of the distance away from parent))

EDIT: also you may need to precache and include the collsion model as 3arc maps dont precache or include some of them (if it doesnt work try precaching it if it still doesnt work add the include to your mod.csv still doesnt work after idk srry)