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"

AnswerHub Maintenance

Background maintenance is scheduled to occur between 9 - 11am EDT on Tuesday, May 21. Site operation may be slower than normal during this time and a brief interruption in operation may be observed

How do I create linked rigid bodies?

Hello,

I originally wrote my own 3D engine in OpenGL + Bullet Physics (and a bunch of other libraries) in order to make a virtual creature evolution simulation. I now want to try to do the same in Unreal Engine 4. Unfortunately, I have no clue where to start or how to do anything, since examples either do not exist or use blueprints (I want to use C++). Could any of you give me some code snippets for creating some rigid bodies and linking them together with motorized joints, or at least point me in the right direction?

Thank you for any help you can offer.

Product Version: Not Selected
Tags:
more ▼

asked Apr 18 '14 at 04:48 AM in C++ Programming

avatar image

CireNeikual
1 1 2 2

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

1 answer: sort voted first

Video

I have a video on this topic here

in my case the joints were not meant to allow any mobility, but I could have just as easily done that

https://forums.unrealengine.com/showthread.php?1832-Video-Dynamically-Combine-Meshes-In-game-to-form-new-composite-Physics-Shapes

UPhysicsConstraintComponent

The key word for your entire goal is this:

UPhysicsConstraintComponent

Look up some info here on this answer hub with that keyword

I've posted elsewhere on this topic

EDIT nvm its hard to find stuff that way

here's how you create the component:

 UPhysicsConstraintComponent* ConstraintComp = NewObject<UPhysicsConstraintComponent>(RootSMA);
 if(!VISVALID(ConstraintComp)) return;

Here's how you activate the constraint:

 //~~~ Init Constraint ~~~
 ConstraintComp->SetConstrainedComponents(RootSMA->StaticMeshComponent, NAME_None, TargetSMA->StaticMeshComponent,NAME_None);

Assuming you are linking two static mesh actors.

All properties are set via

 ConstraintComp->ConstraintInstance = //your own FConstraintInstance

check out the source code for "ConstraintInstance.h"

it has all that you want.

Limit motion, limit angles!

Limit Twists!

or Lock things all together!

Yay!

:)

Rama

more ▼

answered Apr 19 '14 at 03:22 AM

avatar image

Rama
10.6k 446 343 1085

avatar image CireNeikual Apr 19 '14 at 04:40 AM

Thanks for the response! The information you gave me on the constraints will certainly be useful, but I first need to figure out how to make rigid bodies before I link them together. How would I go about making a simple box-shaped rigid body? Sorry for such a noob question!

(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