1
\$\begingroup\$

I am trying to create a dice in ue4 and be able to read off what value it gives. I've made a mesh in Blender and created a texture, imported them and created a blueprint actor and added the static mesh to it.

When I start the game the dice just floats in the air and isn't affected by gravity. I have tried just using the static mesh and I can get that to be affected by gravity. However, I need to add scripts to the object so I can give it a random rotation and read its value, so I created a blueprint actor. I've looked online for a way to give this actor physics, nut nothing.

Does anyone know how I can add physics to a blueprint actor?

Also if anyone has any info on giving the actor a random rotation and reading the value of the dice that would be great.

\$\endgroup\$
2
\$\begingroup\$

What you're looking for is a checkbox titled 'Simulate Physics'. If you open up the blueprint for the actor you created and click on the static mesh component you will see it in the details panel. When this box is not selected your Actor is kinematic- meaning that it ignores physics and only moves when and where you tell it to, when you select this check box physics forces are applied to the Actor and it will no longer float in the air.

When you imported the object, if you didn't check the'auto-generate collision' box in the import options window you might not be able to check the 'Simulate Physics' box, in which case you would need to open up the static mesh editor and add a collider to it manually. I believe 'auto-generate collision' is enabled by default though so if you didn't change the setting you shouldn't have any problems.

Look into the SetActorRotation and GetActorRotation nodes, and the RandomIntFromRange node to supply a random rotation to the Actor.

\$\endgroup\$
0
\$\begingroup\$

Here's a supplemental answer for anyone looking to add "Simulate Physics" on the fly to an actor via a blueprint function, and perhaps the search results brought you here based on the title of this posting. There is a function called "Set Simulate Physics" which enables you to do exactly that.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.