Announcement

Collapse

The Infinity Blade Forums Have Moved

We've launched brand new Infinity Blade forums with improved features and revamped layout. We've also included a complete archive of the previous posts. Come check out the new Infinity Blade forums.
See more
See less

Skeletalmesh KActor with physics

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Skeletalmesh KActor with physics

    Yup, I pretty much sumed up my problem on the title. I have a KActor, with no physics. I added in a phAt but no dice. Its a placeable kactor, and I dont really want it to be uber physics or anything, just to have a small gravity and heavy feeling to it. Any idea or suggestions would be appreciated.

    Thanks!

  • #2
    What do you mean you added in a phAt? Do you mean you added a PhysicsAsset to your actor?

    I think if you go into your KActor's properties window, you should see an option called "Physics Weight" under your skeletalmeshcomponent tab. Try setting it to a value greater than zero, see if anything happens.

    Failing that, I think UDN also lists some video tutorials on the subject from 3DBuzz, which you can pick up here: http://udn.epicgames.com/Three/Video...%20Using%20UDK

    Other than that, can't really recommend much to you. Good luck.

    Comment


    • #3
      Yep, I added a physics asset to the skel mesh, but nothing really happened. It defies gravity and stuff.

      /edit

      Also, even though through the code I specify a skeletalmeshcomponent, in the editor there are no skeletalmeshcomponent tabs. There is a staticmesh tab, but it says there's no mesh in it.

      I know the skeletalmesh is there though, i can see it, and particles popup where the sockets are. Is there any other way?

      Comment


      • #4
        there must be an "WakeOnLevelStart" -option (F4) in your placeable KActor I think.
        If so, check it.

        Comment


        • #5
          Yeah, I already know its there. And its already toggled. Its on by default, and it didnt really matter if it was on or off, both ways it has no physics and I cant move it with the physics gun either

          Comment


          • #6
            Bump, here's some of my code so you guys can see what im doing or.. trying to at least

            Code:
            class MercedesHull extends KActor
            	placeable;
            
            var int Health;
            //var DynamicLightEnvironmentComponent LightEnvironment;
            var ParticleSystem FireEmitter1, Explosion;
            var bool Fire1;
            var bool Fire2;
            var bool Fire3;
            var bool ExplosionEm;
            var SkeletalMeshComponent Mercedes;
            
            var class<DamageType> dmgType;
            var float DefaultImpulse;
            
            auto state Active
            {
            
            	event TakeDamage(int Damage, Controller EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType, optional TraceHitInfo HitInfo, optional Actor DamageCauser)
            	{
                    dmgType = DamageType;
            	`log("Damage done "@Damage);
            	Health -= Damage;
            	Super.TakeDamage(Damage, EventInstigator, HitLocation, Momentum, DamageType, HitInfo, DamageCauser);
            	
            	
            	if(!Fire1 && Health<=70)
            	{
            		SpawnEffect(1);
            		Fire1=true;
            	}
            	
            	if(!Fire2 && Health<=50)
            	{
            		SpawnEffect(2);
            		Fire2=true;
            	}
            	
            	if(!Fire3 && Health<=20)
            	{
            		SpawnEffect(3);
            		Fire3=true;
            	}
            
            	if(Health<=0 && !ExplosionEm)
            	{
            		ExplosionEm=true;
            		ExplodingCar();
            		HurtRadius
            			(
            			    75,
            			    128,
            			    dmgType,
            			    0,
            			    Location,
            			    None,
            			    EventInstigator,
            			    false
            			);
            	}
            	
            	}
            
            	simulated function Tick(float DeltaTime)
            	{
            		
            		super.Tick(DeltaTime);
            
            		if(Health<=35 && Health>0)
            		{
            			Health-=5;
            			`log("Self Damage for 5 points, HP left "@Health);
            		}
            		if(Health<0 && !ExplosionEm)
            	        {
            			ExplosionEm=true;
            			ExplodingCar();
            
            		}
            	}
            
            	
            	function ExplodingCar()
            	{
            		SpawnEffect(4);
            		ExplosionEm=true;
            		ApplyImpulse(vect(0,0,10),DefaultImpulse, vect(0,0,0));
            		HurtRadius
            			(
            			    1000,
            			    1000,
            			    dmgType,
            			    0,
            			    Location,
            			    ,
            			    ,
            			);
            
            		GoToState('Dead');
            	}
            
            }
            
            
            state Dead
            {
            	ignores TakeDamage,TakeRadiusDamage;
            	
            }
            
            
            function SpawnEffect(int number)
            {
            if(number==1){ WorldInfo.MyEmitterPool.SpawnEmitterMeshAttachment(FireEmitter1,Mercedes, 'FireParticle1',true,,);}
            
            if(number==2){ WorldInfo.MyEmitterPool.SpawnEmitterMeshAttachment(FireEmitter1,Mercedes, 'FireParticle2',true,,);}
            
            if(number==3){ WorldInfo.MyEmitterPool.SpawnEmitterMeshAttachment(FireEmitter1,Mercedes, 'FireParticle3',true,,);}
            
            if(number==4){ WorldInfo.MyEmitterPool.SpawnEmitterMeshAttachment(Explosion,Mercedes, 'FireParticle3',true,,);}
            
            }
            
            defaultproperties
            {
            Fire1=false
            Fire2=false
            Fire3=false
            ExplosionEm=false
            Health=100
            bBlockActors=true
            bCollideWorld=true
            bCollideActors=true
            bPathColliding=true
            
            
            DefaultImpulse=20.0
            
            //particlesystems
            FireEmitter1=ParticleSystem'Particles.FlameTorch_CARS'
            Explosion=ParticleSystem'Particles.Explosion_Mercedes'
            
            //Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment
            //		bSynthesizeSHLight=true
            //		bUseBooleanEnvironmentShadowing=false
            //	End Object
            //	LightEnvironment=MyLightEnvironment
            //	Components.Add(MyLightEnvironment)
            
            bWakeOnLevelStart=true
            
            Begin Object class=SkeletalMeshComponent name=MercedesHull
            	SkeletalMesh=SkeletalMesh'HD_CivilianVehicles.Mercedes_Rigged'
            	PhysicsAsset=PhysicsAsset'HD_CivilianVehicles.Mercedes_Rigged_Physics'
            	CollideActors=true
            	BlockActors=true
            	BlockNonZeroExtent=true
            	BlockZeroExtent=true
            	Scale=10.0
            	LightingChannels=(Dynamic=TRUE)
            	AlwaysCheckCollision=TRUE
            	End Object
            	Components.Add(MercedesHull);
            	Mercedes=MercedesHull;
            }
            The code itself still has a couple of glitches, but I can fix those myself. Im more worried about why it has no physics at all.

            Comment


            • #7
              try to set DefaultImpulse higher for testing purpose (like 20000).
              and to be sure set "Health <= 0" in Tick.

              hope it changes something

              Comment


              • #8
                done and done, still no gravity and no physics on the car though...

                Comment


                • #9
                  Why are you using KActor? KActor is for static mesh rigid bodies. KAsset is for skeletal mesh rigid bodies.

                  Comment


                  • #10
                    Of course... it makes sense now!

                    You said that the skeletalmeshcomponent did not show up in your object's properties, right? It's because in the code you pasted, you have not formally declared the end of the object, and added the component.

                    In your code here:
                    Code:
                    Begin Object class=SkeletalMeshComponent name=MercedesHull
                    	SkeletalMesh=SkeletalMesh'HD_CivilianVehicles.Mercedes_Rigged'
                    	PhysicsAsset=PhysicsAsset'HD_CivilianVehicles.Mercedes_Rigged_Physics'
                    	CollideActors=true
                    	BlockActors=true
                    	BlockNonZeroExtent=true
                    	BlockZeroExtent=true
                    	Scale=10.0
                    	LightingChannels=(Dynamic=TRUE)
                    	AlwaysCheckCollision=TRUE
                    	End Object
                    	Components.Add(MercedesHull);
                    	Mercedes=MercedesHull;
                    }
                    On the next line after your "Mercedes=MercedesHull;" parameter, you need to add this:

                    Code:
                    End Object
                    Components.Add(MercedesHull)
                    Now the skeletalmeshcomponent tab should end up in your properties now, along with your physicsasset property. But I don't know if this will create the proper physics for your object though.

                    Start from there, see what happens.

                    Comment


                    • #11
                      @ADayInForever uhh that line is right there though. Right before the mercedes=mercedeshull, I end the object and add it in to the components list. I moved the code around though and still no Physis Weight in any tab, just in case.


                      @ffejnosliw I'm using KActor so I can use the ApplyImpulse function, KAsset doesnt have that.

                      Comment


                      • #12
                        You can implement ApplyImpulse yourself since the relevant functions are implemented in PrimitiveComponent anyways. StaticMeshComponent and SkeletalMeshComponent are both subclasses of PrimitiveComponent.

                        You could probably copy and paste KActor.ApplyImpulse() into KAsset no problems. Although make sure you subclass KAsset, instead of modifying the original source code.

                        Comment


                        • #13
                          Well, extending from KAsset doesnt do the trick by itself though, the car is pretty much still floating, and not movable though.

                          Comment


                          • #14
                            It sounds like you are making a vehicle. Can I ask why you aren't using the vehicle classes?

                            Comment


                            • #15
                              Because its not a vehicle per se, it's not meant to be used, just stand there and explode whenever I shoot at it. The idea is having multiple vehicles that will explode after X amount of hits, while shooting at it it catches on fire and the moment of the explosion it causes damage to everything surrounding it. If it explodes, it should obviously raise up a bit or something to add in some dramatic effects... but i cant even get it to move at all after exploding. I use a skel mesh to use sockets, where i spawn the particle systems of fire and explosion.

                              Comment

                              Working...
                              X