|
|
|
#1 |
|
Junior Member
Join Date: Dec 2001
Posts: 10
|
Help with towing a trailer
Hi guys...
Hope you can help me figure out something that's driving me nuts! Currently working on a little game that involves lorries/trucks. I've got near enough everything sorted except for one thing...getting the lorry cab to pull the trailer. How on earth do I do that??? The trailer needs to follow the cab around realistically pivoting at the trailer's rear wheels and the trailer/cab connection. Can anyone point me in the right direction or, even better, give me a peek at the actionscript that would sort this out? Thanks for your help! Spu
__________________
Error 745a - Bad or Missing Keyboard, press F1 to continue |
|
|
|
|
|
#2 |
|
Student
Join Date: Apr 2001
Location: -
Posts: 4,756
|
wouldn´t that involve IK (inverse kinematic) ?
back in the days of GTA2 I remember some slobby implented attempt for doing that. ![]() in any case it would mean that the trailer always points towards a spot of the truck (eihter the pivot itself or an offset pivot of that one). And with every move of the Truck the trailer would have to move with the truck within a constraint. Is this even what you are searching for?
__________________
my new home: polycount old: Curing C. tech | Curing C. designs | tank | ortho. | zelda LTTP | Tile Edit. | scrolling 3d: 3d engine kit | ASE format | 3d binary format |
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Dec 2001
Posts: 10
|
Yep, it's exactly what I'm after. To be honest I never knew anything about IK before your post but I've done a bit of reading on it now and it seems like the way I need to go. Thanks a lot!
Does anyone have any example code by any chance??? Thanks
__________________
Error 745a - Bad or Missing Keyboard, press F1 to continue |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Dec 2001
Posts: 10
|
ChaseNYC - Thanks for the reply. Yep, I'd seen that when I was searching around for an answer. Although that's what I wanted to achieve, it did actually say how to do it.
__________________
Error 745a - Bad or Missing Keyboard, press F1 to continue |
|
|
|
|
|
#7 |
|
Please, Call Me Bob
Join Date: Aug 2006
Location: Pensacola, FL
Posts: 875
|
i had made something in class (due to boredom) that is similar to what you ask, not sure if it uses inverse kinetics though, i never read up on the topic
http://trogdorffe.tripod.com/attempted_optimization.swf pardon me if its slow/poor looking, i made it kind of messy, and this is my attempted optimization basically i find the dircetion one chain link is relative to another, and whilst keeping the same direction, set the distance to a constant all the while, adding the _x and _y differences to the x and y speeds (later on during my boredom, I also distributed this energy between the two links evenly, to simulate action/reaction pairs, didnt seem to change much though) virtual chain!! got a better looking one on my comp that has a bevel effect added
__________________
|
|
|
|
|
|
#8 |
|
Junior Member
Join Date: Dec 2001
Posts: 10
|
Thanks for the links, Walnoot & trogdor458.
I've read through all of the info you guys have given me but *still* having trouble putting it into practice. It's the ability to control it with the keyboard rather than the mouse that's giving me grief. I've attached what I've got so far but the movement is wrong. Keys UP & DOWN should make it go forward and backwards not increase/decrease the Y position. The same goes for LEFT & RIGHT keys. Anyone get an ideas, please? Thanks to everyone for your help!
__________________
Error 745a - Bad or Missing Keyboard, press F1 to continue |
|
|
|
|
|
#9 |
|
Please, Call Me Bob
Join Date: Aug 2006
Location: Pensacola, FL
Posts: 875
|
you mean you want the car to move correctly? because that should be easy enough
__________________
|
|
|
|
|
|
#10 |
|
Junior Member
Join Date: Dec 2001
Posts: 10
|
Yep, the car/cab to move like a normal car would and the trailer to follow. I've tried using the code I was using before I added the trailer that rotated the car but that then screwed up the movement of the trailer.
__________________
Error 745a - Bad or Missing Keyboard, press F1 to continue |
|
|
|
|
|
#11 | |
|
Please, Call Me Bob
Join Date: Aug 2006
Location: Pensacola, FL
Posts: 875
|
use this movement instead:
Quote:
__________________
|
|
|
|
|
|
|
#12 |
|
Junior Member
Join Date: Dec 2001
Posts: 10
|
Thank you so much, mate! That's what I needed....I think.
![]() Thanks again!
__________________
Error 745a - Bad or Missing Keyboard, press F1 to continue |
|
|
|
![]() |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|