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"

Getting rotation and set location to work with simulated physics

In my script, I have an actor that when colliding with the player, will check if certain requirements are met and if they are, they move into the player to be consumed (deleted). If they aren't. a basic physics simulation takes place and they are knocked away.

When I attempt to do this with simulate physics enabled, the actor doesn't move to set location (using the SetActorLocation node). There is also no rotation. When it is disabled, the actor rotates and moves to location but I have no physics simulation.

I have tried enabling and disabling physics as collisions take place but if I have simulate physics enabled by default and simply disable it when criteria is met, the SetActorLocation doesn't work and the actor remains static. If I have simulate physics disabled by default and only enable it when the criteria for collision is not met, the rotating actor suddenly rotates to the default position and stop rotating but the physics simulation works.

Is there anyway to get around this or fix this? Thanks in advance. I would post my blueprints but they are a bit messy and quite long at the moment.

Product Version: UE 4.8
more ▼

asked Jul 25 '15 at 11:43 AM in Blueprint Scripting

avatar image

35 6 10 13

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

2 answers: sort voted first

Hello @ReallyGoodPie ,

I found two solutions for you that will both work when simulating physics.

The first solution is to apply the rotation directly to your static mesh component in your actor Blueprint. As you can see below I use the "CombineRotators" node to create a new rotation for my "Cube" static mesh ever frame making it spin.

alt text

The second solution is to use the "Add Angular Impulse" node on your static mesh rotate it by physically applying impulses. I prefer this solution more because I think it is a little less hacky than the first solution and leads to more realistic behavior.

alt text

I hope this answer helps,


rotation 1.png (94.2 kB)
rotation 2.png (50.5 kB)
more ▼

answered Jul 25 '15 at 05:57 PM

avatar image

488 53 38 57

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

How do you get the rotation of the physics body? I can rotate my physics-enabled actor with thrusters, but get rotation is returning zeros. If I collide and get spun around, I've no idea which way the actor is pointing

more ▼

answered Sep 06 '16 at 07:13 AM

avatar image

16 2 4

avatar image Ramboozled Sep 13 '16 at 07:24 PM

You would need to get the world rotation instead of the relative rotation to get something different than 0's

avatar image RE-Games Sep 16 '16 at 05:43 AM

No, that is incorrect, the world rotation was zero... I moved the mesh to be the root of the actor, and then it worked as expected.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

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

Answers to this question