PDA

View Full Version : Sphere Collision



Gegen2007
11-27-2007, 05:51 PM
I am trying to create an object that has the physics of a ball, it inherits from a projectile

I added this in the default properties:

Begin Object Class=CylinderComponent Name=CollisionCylinder0 ObjName=CollisionCylinder0
CollisionHeight=0.100000
CollisionRadius=10.000000
CollideActors=True
End Object

CylinderComponent=CollisionCylinder0
Components(0)=CollisionCylinder0

Funny thing; when I spawn the actor; I got a nice crash... duh... What's wrong ?

Also, anyone understood what those ObjectArchetype are for ? Except for winning the award of the most abstract class field ever...

VerteX
11-27-2007, 06:42 PM
no idea (don't have my ce yet)

Bonehed316
11-28-2007, 03:44 AM
CollisionHeight is really REALLY small.

You probably want BlockActors=True also.

Do Components.Add(CollisionCylinder0) instead of setting the index manually.

FYI, ObjName is optional.

Bonehed316
11-28-2007, 03:45 AM
..and make sure Projectile doesn't already have a CollisionCylinder, or you're just adding components that aren't necessary. Not sure off the top of my head if it does or not.

Bonehed316
11-28-2007, 04:00 AM
...and Object Archetypes work like default objects. In fact, they ARE default objects. You can create an archetype from the editor, by placing an instance of a class, and right clicking -> selecting Create archetype. Name it, save it. Then, pass this archetype in to the ActorTemplate argument of the Spawn function, and any properties you change/modify/add/remove from the archetype will be propagated to the newly spawned actor. The actor's archetype will be the instance you passed in to spawn, and that's how it works. :) Basically, archetypes are a template.

As far as the archetype garbage you see in all of the exported scripts, you just ignore it. You can get yourself in to a ton of trouble tinkering with it, so just ignore it.

Gegen2007
11-28-2007, 05:55 AM
CollisionHeight is really REALLY small.

You probably want BlockActors=True also.

Do Components.Add(CollisionCylinder0) instead of setting the index manually.

FYI, ObjName is optional.

Thanks for the kind help Bonehed

Ah well, I am replacing component(0) that is already a collision component

schizoslayer
11-28-2007, 09:33 AM
Thanks for the kind help Bonehed

Ah well, I am replacing component(0) that is already a collision component

You can override the properties of a component without creating a new one or having to add it or set the reference to it.

In this case you should only need:



Begin Object Name=CollisionCylinder0
CollisionHeight=0.100000
CollisionRadius=10.000000
CollideActors=True
End Object


The important part is the name of the component and that it matches the name of the component you are overriding. It will inherit properties from the parent class in a similar way to all other default properties.

Bonehed316
11-28-2007, 12:10 PM
Ah well, I am replacing component(0) that is already a collision component

You can use Components.Remove(ComponentName) to remove a component (if you're not using it anymore). But if you're using one of the same class, its much easier to just do like schizoslayer said, and override the existing one.

Gegen2007
11-29-2007, 05:25 AM
You were right schizoslayer, now it does not crash anymore, but it did not give the ball physics I wanted

I am clueless how to achieve that

schizoslayer
11-29-2007, 12:58 PM
I'm just guessing now but you should be able to use the StaticMeshComponent for collision if you turn on the relevant flags in the component and remove the cylinder component.

You will probably also need to set the projectiles physics to Phys_RigidBody.