UE2 - UT2kX Decoration collide with vehicle wheels?

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

JohnnySix

Caffienated Haemoglobin
Apr 6, 2002
406
0
16
England
planetunreal.com
I ported over the pylon (a traffic cone) decoration from UT - and with some minimal changes, it works when hit by pawns or weapon fire and the karma collision of vehicles, but it doesn't collide with the vehicles wheels.

Should I instead make the cone as a Karma object, or would that be too laggy (my reason for using the UT pylon code, was that it'd be less taxing that Karma on processing time)

Code:
//-----------------------------------------------------------
// Bouncy Cone!
//-----------------------------------------------------------
class J6ConeDeco extends decoration;




var bool bFirstHit;

function Attach( Actor Other )
{
    Velocity.X = 0;
    Velocity.Y = 0;
    Velocity.Z = FMin(0, Velocity.Z);
}

function Timer()
{
    SetCollision(true,true,true);
}

function Bump( actor Other )
{

        Velocity += 1.5 * VSize(Other.Velocity) * Normal(Location - Other.Location);
        if ( Physics == PHYS_None ) 
            Velocity.Z = FMax(Velocity.Z,250);
        SetPhysics(PHYS_Falling);
        SetTimer(0.3,False);
        Instigator = Pawn(Other);
        SetCollision(true,false,false);
        StartRotating();
}

function StartRotating()
{
    RotationRate.Yaw = 250000*FRand() - 125000;
    RotationRate.Pitch = 250000*FRand() - 125000;
    RotationRate.Roll = 250000*FRand() - 125000;    
    DesiredRotation = RotRand();
    bRotateToDesired=False;
    bFixedRotationDir=True;
    bFirstHit=True;
}

function Landed(vector HitNormal)
{
    local Rotator NewRot;
    Super.Landed(HitNormal);
    NewRot = Rotation;
    NewRot.Pitch = 18768;
    SetRotation(NewRot);
}

Auto State Animate
{


	function BeginState()
	{
		super.BeginState();

		SetCollision(true,true,true);
		NetUpdateTime = Level.TimeSeconds - 1;

	}

    function HitWall (vector HitNormal, actor Wall)
    {
        local float speed;

        Velocity = 0.5*(( Velocity dot HitNormal ) * HitNormal * (-2.0) + Velocity);   // Reflect off Wall w/damping
        speed = VSize(Velocity);
        if (bFirstHit && speed<400) 
        {
            bFirstHit=False;
            bRotatetoDesired=True;
            bFixedRotationDir=False;
            DesiredRotation.Yaw=Rand(65535);
            DesiredRotation.Pitch=Rand(65535);
            DesiredRotation.Roll=0;
        }
        RotationRate.Yaw = RotationRate.Yaw*0.75;
        RotationRate.Roll = RotationRate.Roll*0.75;
        RotationRate.Pitch = RotationRate.Pitch*0.75;   
        If (speed < 50) 
        {
            bBounce = False;
            DesiredRotation.Yaw = Rotation.Yaw;
            DesiredRotation.Roll = Rotation.Roll;
            DesiredRotation.Pitch=18768;
            SetRotation(DesiredRotation);
        }
    }   


	function TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation,	Vector momentum, class<DamageType> damageType)
	{
        SetPhysics(PHYS_Falling);
        bBounce = True;
        Velocity += Momentum/Mass;
        Velocity.Z = FMax(Momentum.Z, 200);
        StartRotating();
	}


}




//=============================================================================
// defaultproperties
//=============================================================================

defaultproperties
{
    DrawType=DT_StaticMesh
	bStatic=false
	bStasis=false
	bDamageable=false
	bCanBeDamaged=false
	bEdShouldSnap=true
	bUseCylinderCollision=true
    bCollideActors=true
    bCollideWorld=true
    bBlockActors=true
	bBlockKarma=true
	bFixedRotationDir=true
	bOrientOnSlope=false
	bPushable=true
	bMovable=true
    SurfaceType=EST_Glass
    CollisionRadius=24.000000
    CollisionHeight=4.000000
    bProjTarget=True
    bAutoAlignToTerrain=True
	bNetInitialRotation=true
	RemoteRole=ROLE_SimulatedProxy
	bNetNotify=true
	CullDistance=2500
	NetUpdateFrequency=1
    StaticMesh=StaticMesh'BulldogJ6.J6ConeTest'
    Skins(0)=Shader'BulldogJ6.Shaders.J6TestCone'
    Skins(1)=Shader'BulldogJ6.Shaders.J6TestCone'

}
 

JohnnySix

Caffienated Haemoglobin
Apr 6, 2002
406
0
16
England
planetunreal.com
Yes, making it a Karma object (e.g. KActor) could solve the problem. Then again, maybe your object (class and StaticMesh) just needs Karma collision properties.

Yeah, it has a collision box - what I've just noticed, when showing collision in-game, is that the collision rotates out of alignment with the actual mesh, so the cone will be pointing one way, but the collision will rotate another. :p
 

JohnnySix

Caffienated Haemoglobin
Apr 6, 2002
406
0
16
England
planetunreal.com
Made it a Karma Object instead.

Any tips on :

  • Stopping it from stopping vehicles - but not intersecting the mesh
  • Making it collide with wheels
  • Preventing it from intersecting BSP/Terrain/Meshes

It has a Karma primitive created within max as a watertight, convex mesh.

A video showing what works and what doesn't (excuse music -added random track to cover up music that was playing on winamp - don't need YouTube taking down videos/banning account -they seem a bit trigger-happy at the moment.)

http://www.youtube.com/watch?v=lAKlE2-rScw
 

JohnnySix

Caffienated Haemoglobin
Apr 6, 2002
406
0
16
England
planetunreal.com
Anyone got any advice? I presume the static-mesh collision on vehicles includes the wheels, even if the karma primitives/general physics don't. Would it be possible to get the cone to pick up the vehicle's static-mesh collision?

Right now, unless you scale it up to the height of a man, it won't collide with anything other than the vehicle's basic karma box primitive.

Would it be costly to do a trace from the top of the pylon and check every tick or two if a vehicle was overhead? It could get quite complicated if it needed to check the vehicle was above it, count the wheels, their position, the size and then calculate if any are touching it.
 

JohnnySix

Caffienated Haemoglobin
Apr 6, 2002
406
0
16
England
planetunreal.com
Wouldn't mind making this work again, should I just run a trace for 200 units or so above the cone, then set its speed to that of the colliding object and have it rotate randomly?
 

brold9999

New Member
Apr 5, 2009
142
0
0
The wheels might have special collision handling. I am a little surprised that they don't collide with your cones, however. Do they collide with other Karma objects?
 

JohnnySix

Caffienated Haemoglobin
Apr 6, 2002
406
0
16
England
planetunreal.com
No, that's the thing, the wheels don't actually collide at all on Scars, other than to simulate movement on ground, only the collision box of the vehicle collides.

If it were a Kcar, it'd be no problem, but Scars are effectively hovercraft with simulated wheels/suspension (cheaper for replicating over a network).
 

brold9999

New Member
Apr 5, 2009
142
0
0
Ah, good point. I was assuming KCars and I'm not sure why.

In this case you may need to work around it somehow. The traces could probably work, but first I would check to see if any of the collision events (touch, encroachedBy, etc) get triggered when the vehicle drives over them. That may provide a lower-cost method of detecting the collisions.
 

brold9999

New Member
Apr 5, 2009
142
0
0
I don't think processTouch is an event, it is called from script from Touch usually. But put log messages in touch, bump, encroachedBy, etc. - all of the touching related functions, to see if any get activated.