Physics Component Init Bug [4.6]

How to Repro in C++

  1. Spawn an Actor from another Actor’s BeginPlay() function.
  2. Call SetActorLocation on the spawned actor in BeginPlay()
  3. Try to apply physics to the spawned actor during tick and note that physics do not work

2 Ways to get out of the state:

  1. Change any physics property on the object while the level is playing
  2. Physically change the object location with editor tools while the level is playing

Permanent workaround:

Wait a frame before setting the actor location

Hey Hyperdr1ve,

This is actually correct behavior and not a bug after discussing with some colleagues. Tick is called for every frame where as Event Begin Play will start once the level has loaded.

Thanks!

Tim

This is confusing, maybe I didn’t explain this very good. Is it expected behavior that if you spawn an actor and set his location in some other actor’s beginplay function that you can then never ever apply physics to that object in any tick function?

I’m aware of the difference in calls to tick vs begin play, the only thing happening in begin play is the object being spawned and his location being set. After that, applying forces in tick functions is essentially a NOOP. The end result of what I’m describing is that objects spawned like this never respond to physics forces that are applied to them (regardless of where you apply those forces i.e. in tick or an input event).

oh, okay. I didn’t get that from the initial post. That may be my fault as well. I understood it as you were wanting to have physics start when the tick does, but it was not since the level hadn’t loaded with the event begin play.

I’m not a programmer so I’ll try and repro this in BP first before I bug the programmer on our team. :slight_smile:

I’ll let you know. Thanks for clarifying

Just tested this with BP and not seeing the same. Can you verify you’re seeing the same via BP before digging into code for troubleshooting?

Here is a video of my test:

If you have a different way setup that reproduces this I’m interested.

After trying to make a sample project to illustrate this, I can’t get it to repro either. The issue is obviously more complex than spawning and adding forces but I don’t know to what degree. I guess we’ll mark this as answered until I can provide a reliable reproduction case. Sorry for wasting your time here :frowning:

Not a waste of time. :wink:

Let me know if you find something though.