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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How to prevent an actor to rotate / Lock rotation ?

Hello everybody !

I have a problem : I need a cube that can move when I push It but I want that it can't rotate (no rotation on all axis) and that it can fall in a hole.

alt text

If someone has a solution to this .. I tried many thing in the "Physics" part ...

Thank you :) !

Product Version: Not Selected
Tags:
rotate_problem.jpg (838.1 kB)
more ▼

asked Oct 29 '14 at 08:01 PM in Using UE4

avatar image

Footy Element
61 3 6 7

avatar image gamesmyth27 May 16 '16 at 05:51 PM

Looks like the behavior of a collision box that needs to be edited to the exact shape of the square. Collision box too large, the box appears to float in space. Collision box is actually a circle? Box is rolling and the corners are clipping into other objects. True statement?

avatar image gamesmyth27 May 16 '16 at 06:04 PM

Also, if that box is falling off the edge and then rolling, there are multiple ways to solve that. Using a constraint would be rather sketchy but using an invisible box as a trigger to despawn the box that you are moving and then spawn the same box exactly where you would like for it to drop. Although they would have to line up fairly close to give the illusion of being the same box. Set the box object as having no gravity until it collides with an invisible box opposite of the edge where it is rolling. Tricky technicality, definitely.

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

4 answers: sort voted first

On the physics module, drop down the constrains options and lock the rotation of all the axis you want.alt text

capture.png (12.9 kB)
more ▼

answered Oct 28 '15 at 05:11 PM

avatar image

Angeloss
11 1 2

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

I have used a component attached to a spring arm to both lock or lag a components rotation of which is parented to the spring arm.

more ▼

answered Nov 23 '17 at 11:40 PM

avatar image

FoundThePin
71 5 5 17

avatar image GlassBeaver Jul 23 '18 at 01:36 PM

I love this solution, thanks for posting!

avatar image mervpls Apr 24 '19 at 06:23 AM

Nice! I'm using this for my VR character's body! Works great!

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

Ha ha, interesting problem :)

Let's say that this box is an actor with box static mesh that can simulate physics. Then you can implement something in graph: use Tick event and call Set Actor Rotation with [0 0 0] rotator.

Marcin

more ▼

answered Oct 29 '14 at 08:31 PM

avatar image

mpo
578 23 15 46

avatar image Footy Element Oct 29 '14 at 09:46 PM

Hey :) It is a solution and I've thinked about it before posting my question, as a temporary solution.

But I think that it is not an optimal solution because I have around 10 boxes so if I have to set the rotation at every moment ... :p.

It must exist something more optimal.

avatar image mpo Oct 29 '14 at 10:12 PM

Of course it's not optimal. At least you can use this until someone post something better :) Btw. If you do this in C++ it wouldn't be that bad ;)

Marcin

avatar image twenty one Jan 02 '16 at 09:33 PM

mpo your a beast thank you i had a issue that i wanted lock rotation of a vehicle so the character can look around. iv tried everything else but your method works thank you so much

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

Perhaps you could set up a trigger area surrounding the hole and nearby area that prevents rotate (aka set to 0,0,0) of the actor when it is overlapping. That would prevent using the undesirable tick function and let you use this mechanic on a per-hole basis (haha, now that's a fun time term). You can filter the event by class, if you are concerned about other actors being affected.

more ▼

answered Oct 29 '14 at 09:59 PM

avatar image

DG Gage
1.7k 62 31 129

avatar image Footy Element Oct 30 '14 at 07:37 AM

It would be great but I need that it can't rotate at all on the entire map.

There is two problems :

  • When I push it, it rolls (so it rotate) and it is not what I want, I want it to slide on the floor, like when you push a box in the real world ^^. If I lock axis Z, it slides but it doesn't fall anymore.

  • When I push it on the way for the hole, because there is a long way with some angles, sometime the box is blocked in the angles because it rotate a little ...)

avatar image DG Gage Oct 30 '14 at 11:47 AM

Well there you go then: when it gets pushed, it has some kind of overlap events right? Use that to set the no rotate, as well as the trigger area.

avatar image Footy Element Oct 30 '14 at 03:10 PM

Sorry but I think that there is a misunderstood :

I have a box. I have a character. When the character go in the direction of the box and touch it, I want that he push the box until he stop walking. I need that the box slide and don't rotate at all, so I need to have all the axis locked on rotation only.

I need it to be like that on the entire map.

If I use the "set rotation" 0,0,0 function, it doesn't work not like I want because : - With the tick event the player stop to push and start again when I keep the forward arrow pushed. - With an overlap event, it will not work better.

Something else than "set rotation" must exist :).

But you speak about "set the no rotate" : if you know something to disable rotation on an actor or component, that's what I need :).

avatar image DG Gage Oct 30 '14 at 04:33 PM

alt text

Set up a large invisible box covering the area where the boxes will be, and make a blueprint based off of it. Plug this in and see if that does what you're wanting.

avatar image Footy Element Oct 30 '14 at 05:08 PM

Thank you for your help but It is not what I need :/

Because if the box overlap the area, it will happen only 1 time because the area is the whole map. So it will set the actor rotation of my box to 0,0,0 but it doesn't prevent it to rotate after that.

The "set actor rotation" is not what I need ...

A solution would be to lock axis Z and when it goes over a hole (and overlap a trigger box) unlock the axis Z, but I don't find how to do that ... there is no function to do that :/

There's no way that there is nothing to lock the rotation but I'm not able to find it ...

avatar image DG Gage Oct 30 '14 at 05:38 PM

alt text

Of course! Dur, sorry lol

This event can go inside your box blueprint, and should fire off any time the actor is touched. That should include the ground.

Go into your components in the BP, go to collision, and check this box:

Simulation Generates Hits Events

End result should be that it's always setting rotation to 0 if it's being touched. For falling in the hole, you could use my other solution for a trigger area that's only surrounding the hole.

Let me know if that doesn't work either.

avatar image Footy Element Oct 31 '14 at 11:21 AM

It does the same thing with the event tick and set actor rotation. Set actor rotation is not what I need here :). Because if I use it, the push animation is choppy / jerky. And it is very slow to push the box.

avatar image DG Gage Oct 31 '14 at 11:57 AM

Hmm. Maybe you could rethink the mechanic altogether? It sounds like wanting only PART of its natural physics is problematic.

You could disable physics, but keep overlap events.

On overlap with the player, the box attaches to the player and moves with him.

On detach, give it a small impulse based on the direction it was being pushed on detach. You might have to reenable physics temporarily for the impulse. That'll make it slide a bit.

You could alternatively write in a smooth translation from point A to point B on detach, simulating a slide.

For the holes, you will still need a trigger area. The trigger area would simply tell the box to translate to the center of the top of the hole, and then to the bottom of the hole.

So the mindset of simulating everything might be what you want, so you can have complete control over its physical elements.

(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