Rigid Body Back to Sleep

hello!
how can we keep a static mesh component asleep from blueprint? “put rigid body back to sleep” does not work. Is there a way to change bodyinstance properties from blueprint?
Thank you!

Alexandre

Hello Alexandre,

I have a few questions for you that will help narrow down what information it is that you are looking for.

Quick questions:

  1. When you say that you would like a component to stay asleep, are you saying that you would like for it to never wake up?
  2. When you say that put rigid body back to sleep does not work, do you mean that it does not work for what you are trying to do or that it is not working at all?
  3. Do you want the actor to start asleep until it is acted on?
  4. Could you elaborate on what it is exactly that you are trying to accomplish?

Information:

  1. If yes, could you use a static actor instead of one that simulates physics?
  2. This appears to be working as intended when tested on my end.
  3. There is a check box for this in the details panel called “Start Awake”

I was able to reproduce Put rigid body to sleep not working within the construction script. I have written up a report ( UE-27376) and I have submitted it to the developers for further consideration. The one workaround I was able to come up with may or may not be viable depending on your needs. I used a get all components of class node combined with a for each loop to put the components to sleep on begin play.

  1. We would like to disable the Start Awake property (enabled by default) on a Static Mesh Component with physics simulation: the idea is that it should be frozen until another object touch it. Using an actor instead of a component is not feasible (since we have tens of thousands of components).

  2. I mean that if I call the “put rigid body back to sleep” node, it does not put bodies back to sleep: the bodies will fall from their initial position (since gravity is applied).

  3. Yes, from blueprint.

  4. A metallic pole that is a rigid body placed on ground (while in reality it is inside the ground, so it cannot fall by itself). When the car hit it, it should be detached from ground and act as a sinple rigid body.

Hello Alexandre,

When testing I found that when I wanted to accomplish this sort of task I used the “Start awake” check box to disable the start awake feature for static meshes. I have provided a picture below as an example. This can be done for any static mesh component as long as simulate physics has been turned on. Please let me know if I have misunderstood.

Example:

hi! yes, but we need to do this from blueprint at runtime, not from editor

In that case your first instinct was correct, I would use the “Put Rigid Body to Sleep” node on begin play. I have tested this on my end in 4.10 and it appears to be working correctly on my end. I have provided two examples below of a set up that works on my end.

Examples:

In this example I have set the mesh to sleep on begin play (for components that are already available)

107329-putmeshtosleephelp.png

In this example I have added component at run time and I have set them so that they are asleep on spawn

Additional questions:

  1. Could you provide a screen shot of the blueprint that is not working correctly on your end?
  2. Can you reproduce the “Put Rigid Body to Sleep” node performing incorrectly in a clean project?

Sorry for the misunderstanding! we are using it into construction script, because we need to perform there some physical simulation there and it’s not working as expected.

We are going to try! Tnx!!

Alexandre,

Construction scripts should only be used to set an object’s state (and more specifically, only the things that are replicated through UPROPERTYs). The reason being that in PIE and Cooked Builds objects are first created and then replicated into a level. Since construction scripts are only ever run when objects are created, this means anything that isn’t replicated gets lost.

In your case Put Rigid Body to Sleep actually affects the Physics Scene, which is something that is unique level to level, and therefore not replicated.

The correct approach is to put any behavior like this into OnBeginPlay.
However, for this specific case, there is a flag called “StartAwake” that you could use instead.

Thanks,
Jon N.

ok thank you!