2
$\begingroup$

Right now I have a truck and a trailer. The trailer is parented to an empty, and the empty is vertex parented to the truck where the trailer would hing at. However, although the trailer is always locked to the hinging point on the truck, it does not act like a trailer when the truck is rotated and moved. What has to be done to make the trailer respond in a manner that an actual trailer would? I am trying to make this for the game engine, so using most constraints will not work. I thought of using the Camera actuator, but that does not work very well at all when backing up.

$\endgroup$
2
  • $\begingroup$ What engine are you exporting to? $\endgroup$ Commented Dec 8, 2014 at 8:42
  • $\begingroup$ @Knuckles209cp From context I am assuming he is using the blender game engine $\endgroup$ Commented Dec 8, 2014 at 19:58

2 Answers 2

2
$\begingroup$

Looks like you need to use the BGE Bullet physics engine. Set the objects as Rigid bodies, then setup constraints between them of type Rigid Body Joint.

This way your objects will behave like you expect them to. Scripting similar behavior would be lot of work.

You will need also some collision meshes like ground. There are some videotuts on the net how to setup this, this one is good.

$\endgroup$
5
$\begingroup$

To expand on Jerryno's answer, a Rigid Body Joint is a perfect way to do this. To start with, make both your truck and trailer to the Rigid Body physics type, and position the trailer behind the truck where it would naturally sit while towing it. On your trailer, add a Rigid Body constraint, with the Pivit Type set to "Generic 6 DoF"

constraint settings

You can enable "Display Pivot" to help with placing the pivot, or leave it off if you know the offsets needed to put the pivot on top of the trailer hitch. (The pivot will not show in-game, so this option is only to help set up the constraint.) To eliminate the possibility of collision problems between the truck and trailer, enable "Linked Collision." Ordinarily this would make the trailer able to clip into the truck and look really weird in the process, but you can adjust the rotation limits to stop the trailer from rotating too far. It is important to enable the X, Y, and Z location limits and leave them 0. This will lock the trailer in place behind the truck, and unable to move relative to the truck, it will only be able to rotate around the pivot within the rotation limits specified.

Using stand-in objects to test, this behavior is exactly what we want.

Finished Gif

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .