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"

C++ - Vehicle - Apply torque to wheel,

Hello everyone,

I'm trying to create a realistic vehicle and if possible without having to modify Unreal Engine. The default driving model in UE is bad in one thing and that's the combined throttle/brake axis, namely the fact that even if apply 0.1 of braking, the vehicle goes on full brake and I haven't found a work around this (other than modifying UE).

My second idea was to interact with PhysX (which handles throttle and brake separately) directly bypassing Vehicle Movement Component, but once again haven't found a way to acess PhysX from game code.

My latest idea was to apply forces directly to wheels, which doesn't work as well. But I'm not sure if i'm doing it the right way.

     owner->GetMesh()->GetBodyInstance("Wheel_Rear_Left")->AddTorque(FVector(300, 300, 300), true);
     owner->GetMesh()->GetBodyInstance("Wheel_Rear_Right")->AddTorque(FVector(300, 300, 300), true);

owner is Vehicle Pawn. I also tried to apply each axis separate, but still no efect. The wheels don't spin even in the air. So if anyone can tell what I'm doing wrong, or any hint how to make my previous ideas work, would be greatly appreciated. I mean, 3 beers if I ever meet you in person :)

Jan aka ENiKS,

Product Version: Not Selected
Tags:
more ▼

asked Mar 18 '15 at 11:17 AM in C++ Programming

avatar image

ENiKS
11 2 3 7

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

You need a lot more torque power than 300.

Try going for 50000000.0f.

more ▼

answered Mar 29 '15 at 08:43 PM

avatar image

asperatology
293 30 30 91

avatar image ENiKS Mar 29 '15 at 09:57 PM

i've tried applying even more than that, even that 300 Nm should be enough to get car moving ... Still, the car is not moving

avatar image asperatology Mar 29 '15 at 10:59 PM

GetMesh()->SetSimulatePhysics(true);

Don't use GetBodyInstance();

(comments are locked)
10|2000 characters needed characters left
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