PDA

View Full Version : Realtime DynamicPhysicsVolume creation



Chagrin
10-23-2010, 05:03 PM
Hello all -

I am attempting to create a weapon in unrealscript that creates a DynamicPhysicsVolume when the projectile hits an object.

I have the weapon script working fine (extending UTWeap_RocketLauncher), and ammo can be picked up with no problem (ammo extends UTProj_Grenade), and I am able to fire a custom mesh just dandy. The problem comes in when I try to create a new DynamicPhysicsVolume on impact.

I copied and used the function:


simulated event HitWall(vector HitNormal, Actor Wall, PrimitiveComponent WallComp) //taken from UTProj_Grenade and modified

which I hope is the proper place for the creation of the DynamicPhysicsVolume.

Currently, my main two problems are:

How do I tell the DynamicPhysicsVolume to be spherical? (I think DrawSphereComponent has something to do with it, but I can't figure out how to tell the DynamicPhysicsVolume what shape to use); and

How do I specify its location upon creation? As one solution, I've tried creating a separate class for the DynamicPhysicsVolume, but I cannot find a way to "feed in" a location parameter into the defaultproperties, or otherwise edit its location.

To get around the first problem, I have created a DynamicPhysicsVolume in the editor, then turned it into first a prefab, then later an archetype, and tried to use both in my code, but I cannot seem to access any properties of either prefab or archetype (I suppose I just don't know the syntax).

So, basically, there are a million ways to do this, but I can't get any of them to work.

Thanks for your help!

Chagrin
10-24-2010, 02:30 PM
New information I have learned:

Because a brushcomponent and dynamicphysicsvolume are two separate things, an archetype does not save the brushcomponent, so if I want to use the in-editor creation, I must use a prefab. I still do not know how to access the properties of the prefab, however.

Also, if I want to create a dynamicphysicsvolume in code, without the editor, I should probably use the TetrahedronBuilder, not DrawSphereComponent, but even so I do not know how to make the DynamicPhysicsVolume+BrushComponent into one object. Trying to make it a separate class has so far met with failure.

Anyone have any possible solutions?

Blade[UG]
10-24-2010, 07:55 PM
You can't create brushes in game.