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!
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:
Information:
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.
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).
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).
Yes, from blueprint.
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)
In this example I have added component at run time and I have set them so that they are asleep on spawn
Additional questions:
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!