# How to make an object freely rotate on an axis?

**URL:** <https://forums.unrealengine.com/t/how-to-make-an-object-freely-rotate-on-an-axis/354314>\
**Category:** Platform & Builds\
**Tags:** vehicle, axis, wheel, build, unreal-engine, rotate, question\
**Created:** [April 15, 2016, 5:05pm UTC](https://forums.unrealengine.com/t/how-to-make-an-object-freely-rotate-on-an-axis/354314 "2016-04-15T17:05:35Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![JTrocks55](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JTrocks55](https://forums.unrealengine.com/u/JTrocks55)\
**Post date:** [April 15, 2016, 5:05pm UTC](https://forums.unrealengine.com/t/how-to-make-an-object-freely-rotate-on-an-axis/354314/1 "2016-04-15T17:05:35Z")

</div>

I am developing a building game, and I am working on a rotating part that attaches to what you hit, and then it can rotate. So if you attach it to a cube, then attach a wheel or something to the rotator, it should be able to be pushed around like a cart and the wheel will roll. So basically building vehicles with many parts.

How could I make a part rotate around a single axis so a wheel could be attached to it?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_4030fea0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4030fea0](https://forums.unrealengine.com/u/anonymous_user_4030fea0)\
**Post date:** [April 16, 2016, 2:39am UTC](https://forums.unrealengine.com/t/how-to-make-an-object-freely-rotate-on-an-axis/354314/2 "2016-04-16T02:39:13Z")

</div>

Replying to your specific question - you can add **Rotating Movement** component to any actor. Create an actor and then add a that component.

The bigger issue might be “building a vehicle with many parts”. I would suggest simplifying or separating the two game separate game elements. You can have one part of the game where you “build” and another where you use the object. You can swap out meshes for the final product at the end.

---

<div class="post-metadata">

**Author:** ![JTrocks55](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JTrocks55](https://forums.unrealengine.com/u/JTrocks55)\
**Post date:** [April 16, 2016, 2:46pm UTC](https://forums.unrealengine.com/t/how-to-make-an-object-freely-rotate-on-an-axis/354314/3 "2016-04-16T14:46:08Z")

</div>

That helps, but I mean that I want it to not be a set rate, so if you walk into the vehicle for instance, the wheels will roll just by physics because the rotating part isn’t constrained to a specific rotating motion. Like not having a motor, I want it to freely and loosely rotate based on being pushed around. I will deal with forced/set rotation later.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_4030fea0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4030fea0](https://forums.unrealengine.com/u/anonymous_user_4030fea0)\
**Post date:** [April 17, 2016, 2:07am UTC](https://forums.unrealengine.com/t/how-to-make-an-object-freely-rotate-on-an-axis/354314/4 "2016-04-17T02:07:13Z")

</div>

It sounds like you’re after a vehicle type setup. In which case, have you looked at [this](https://docs.unrealengine.com/latest/INT/Engine/Physics/Vehicles/VehicleUserGuide/) and [this](https://docs.unrealengine.com/latest/INT/Engine/Physics/Vehicles/VehcileContentCreation/index.html)? You can create a new project, choose Vehicle Template. Copy the created pawn so you have two on the map, then use one vehicle to “bump” the other. Is that the type of interaction you want?

---

<div class="post-metadata">

**Author:** ![JTrocks55](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JTrocks55](https://forums.unrealengine.com/u/JTrocks55)\
**Post date:** [April 17, 2016, 3:46am UTC](https://forums.unrealengine.com/t/how-to-make-an-object-freely-rotate-on-an-axis/354314/5 "2016-04-17T03:46:33Z")

</div>

Not really. I want it to be like scrap mechanic. Adding wheels on the fly, thrusters, crazy stuff like that. Like space engineers, no in game editor, just simple adding wheels or seats the same way you place blocks in Minecraft.

---

<div class="post-metadata">

**Author:** ![JTrocks55](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JTrocks55](https://forums.unrealengine.com/u/JTrocks55)\
**Post date:** [April 17, 2016, 3:48am UTC](https://forums.unrealengine.com/t/how-to-make-an-object-freely-rotate-on-an-axis/354314/6 "2016-04-17T03:48:10Z")

</div>

Here is the game btw, in development, on [Itch.io](http://Itch.io): [https://jtrocks55.itch.io/universe-constructor](https://jtrocks55.itch.io/universe-constructor)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_4030fea0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4030fea0](https://forums.unrealengine.com/u/anonymous_user_4030fea0)\
**Post date:** [April 17, 2016, 10:15am UTC](https://forums.unrealengine.com/t/how-to-make-an-object-freely-rotate-on-an-axis/354314/7 "2016-04-17T10:15:25Z")

</div>

Nice - I like it. Keep up what you’re doing 🙂

For your game, I am not sure I entirely understand your specific use case so I can only offer generic advice. Quite often in games the developers “fake” outcomes. If you want to have a wheeled cart that you can push around, create an actor that you can only move along the XY plane. Then add “wheels”. You can setup rotation speed on the wheels with the **RotationMovement** component based on forward velocity. That way the wheels will rotate with variable speed depending on the speed of the cart, but it will not be 100% pure physical simulation. It will look like the cart is moving on its wheels so you get the right outcome but without complex physics simulation.

Otherwise, you can still used wheeled template to learn how to create a wheeled vehicle. Just don’t apply any throttle/steering and it will behave like a dumb cart.

---

<div class="post-metadata">

**Author:** ![JTrocks55](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JTrocks55](https://forums.unrealengine.com/u/JTrocks55)\
**Post date:** [April 17, 2016, 6:11pm UTC](https://forums.unrealengine.com/t/how-to-make-an-object-freely-rotate-on-an-axis/354314/8 "2016-04-17T18:11:29Z")

</div>

Thanks! 🙂

Ok, that helps some, but it is still not the direction I am going. I do not want to make anything preset, I want the player to build everything. So for example, let’s say the player needs to get somewhere quickly. What he or she would do is build a cart with blocks, just like Minecraft, but then add wheels to the side of it: [here is a demonstration](https://www.youtube.com/watch?v=VJE8VMb_EAs&feature=youtu.be)

What I am wanting is this: the little grey things I attached before I added the wheels, I want them to rotate. So you can add wheels on top of those and the wheels will turn.

---

<div class="post-metadata">

**Author:** ![JTrocks55](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JTrocks55](https://forums.unrealengine.com/u/JTrocks55)\
**Post date:** [April 17, 2016, 11:56pm UTC](https://forums.unrealengine.com/t/how-to-make-an-object-freely-rotate-on-an-axis/354314/9 "2016-04-17T23:56:10Z")

</div>

Actually I think I figured it out. This is the first result: [Dropbox - File Deleted](https://www.dropbox.com/s/x05scs7o1nsb8cd/2016-04-17-1808-39.flv?dl=0)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_4030fea0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4030fea0](https://forums.unrealengine.com/u/anonymous_user_4030fea0)\
**Post date:** [April 18, 2016, 11:17am UTC](https://forums.unrealengine.com/t/how-to-make-an-object-freely-rotate-on-an-axis/354314/10 "2016-04-18T11:17:08Z")

</div>

I love it! How did you end up doing it ?

---

<div class="post-metadata">

**Author:** ![JTrocks55](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JTrocks55](https://forums.unrealengine.com/u/JTrocks55)\
**Post date:** [April 18, 2016, 6:27pm UTC](https://forums.unrealengine.com/t/how-to-make-an-object-freely-rotate-on-an-axis/354314/11 "2016-04-18T18:27:08Z")

</div>

Thanks! 🙂

So I just gave the rotator a Physics Constraint Component, and set up some nodes to attach it to the hit object via the physics constraint, then it would rotate freely. Then set up a physics constraint on the tire and made it attach to the rotator the same way. Now I have a working vehicle building system! All that is left is to make a way for the blocks to snap to the vehicle’s grid and attach to the vehicle instead of the world.
