# How would i make a rolling cube like fortnite's?

it recently got into my interest how to make a rolling cube like fortnite’s.

but i’ve encountered some major problems where i cant seem to think about a fix.

the cube has to be able to roll to a given destination, while respecting terrain topography, so that when it rolls it doesnt clip through hills and mountains.

i’ve tried using physics, but that wont really roll the cube up the destination.

if you could give me some advice on how to do it and some examples it would really help me!

i left a pic of the fortnite cube rolling here:

Well, you can’t be 100% sure that not a single part of the cube is going to be clipping into the ground. I never played Fortnite so I have no idea what the “rolling cube” is, but you will need to rely on physics or Inverse Kinematics.

2 Likes

well, of course some parts are going to clip, what i meant is that the cube actually rotated based on the terrain its on. another issue would be making it roll in that direction, and not in a weird motion (the cube as if you’re rolling a box around) thanks for the advice!

I saw an example of a rolling cube on YouTube, and what I would do is make a designated animation for a specific cube, making it rotate as it would move to match the ground.

1 Like

its a good idea, but that will require making a LOT of animations, and the cube might not orientate like the way it should. Inverse kinematics seems like a good idea, but i never handled IK’s and how to make it work on a cube. thanks!

2 Likes

Something like this?
This is a simple part (6,6,6) with a angular velocity constraint.
Property AngularVelocity: 0, 0, -1
Property MaxTorque: 90000

2 Likes

yeah, except it needs to roll to a specific destination and orientatate based on the terrain. Thanks!

Since it is a physics-based constraint, the terrain is taken into account. Also, you can for example set the torque relative to the attachment and then change the orientation to the destination via script.

2 Likes

sure, but using physics wouldnt reach an exact destination i give it, like stopping on a mountain after rolling, rolling effects, or saving the rolls so everyone sees the same thing in all servers. Thanks!

what i mean is, firing a bindable event that moves it to a given vector3 location, by rolling and orientating based on the terrain too.

There are several solutions for this problem! For example, you could take two parts, anchor one of them and connect the second, your unanchored cube, via a rope constraint and then move your part 1 with the TweenService to the desired location.

Alternatively you can create a custom huanoid as a cube and then move it with the MoveTo and the PathFindingService to your destination. For your cube you only need to create a simple 360 degree rotation as a walking animation.

thanks! seems like a great idea

here’s the effect i want to achieve:https://www.youtube.com/watch?v=jh_FEPuXAUY

1 Like