Download

Questions on Skeletal Mesh Actor, Physics Bodies, and UPhysicsHandleComponent

Question 1. I have a class that inherits skeletal mesh actor. I put code that needs to execute continuously in Tick(DeltaTime);

In the .h



virtual void AVRMeleeWeapon::Tick(float DeltaTime);

In the .cpp


void AVRMeleeWeapon::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);

	GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, TEXT("I'm ticking"));
}

I added this message because it seemed like none of the code was executing, and this message never appears. It would seem that the actor is not ticking at all. How do I make it tick?

SetActorTickEnabled(true); I tried this in the constructor, which resulted in U4 crash on trying to load my game module, so this is not the solution lol.

Question 2. My character will have the ability to pick up rigid bodies with a constraint on his hand. Is there an easy way to opt a specific actor (the character) out of collision with another actor. A picked up rigid body will still need to collide with other characters, but I don’t want the character holding it to be able to fly around Silver Surfer style. I also don’t want him to fly off the map from holding it too close to himself.

Question 3. Can anyone find an example of how to use UPhysicsHandleComponent? This seems to be the update of the Physics Grabber Component thing from UDK, but I cannot find examples on how to use it? It appears that I cannot attach it, so I assume I need to send it updated positional and rotational data manually? Any reference on spawning constraints at runtime would be good, too. I’m actually having a lot of trouble just adding a PhysicsHandleComponent to my character.

Question 1. Put this code in constructor:



PrimaryActorTick.bCanEverTick = true;


Hope this helps. :slight_smile:

It works. Thank you very much.

Question 4. Is there any reference available on blending physics and animation? If I am not mistaken, vehicles do this. I am seeking to do this on my character.