x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

[Closed] 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

Product Version: UE 4.10
Tags:
more ▼

asked Sep 16 '16 at 05:27 PM in Using UE4

avatar image

Answers.Archive STAFF
1.9k 210 316 690

avatar image Answers.Archive STAFF Sep 16 '16 at 05:27 PM

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"

avatar image Answers.Archive STAFF Sep 16 '16 at 05:27 PM

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.

avatar image Answers.Archive STAFF Sep 16 '16 at 05:27 PM

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:

alt text

avatar image Answers.Archive STAFF Sep 16 '16 at 05:27 PM

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

avatar image Answers.Archive STAFF Sep 16 '16 at 05:27 PM

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)

alt text

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

alt text

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?

avatar image Answers.Archive STAFF Sep 16 '16 at 05:27 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

The question has been closed Sep 16 '16 at 05:28 PM by AndrewHurley for the following reason:

The question is answered, right answer was accepted


1 answer: sort voted first

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.

more ▼

answered Sep 16 '16 at 05:27 PM

avatar image

Answers.Archive STAFF
1.9k 210 316 690

avatar image Answers.Archive STAFF Sep 16 '16 at 05:27 PM

We are going to try! Tnx!!

avatar image Answers.Archive STAFF Sep 16 '16 at 05:27 PM

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.

avatar image Answers.Archive STAFF Sep 16 '16 at 05:27 PM

ok thank you!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question