Steering to move characters

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
paclito
Prole
Posts: 35
Joined: Wed Apr 22, 2009 8:33 pm

Steering to move characters

Post by paclito » Sun Aug 02, 2009 10:09 pm

I'm trying to create a car that moves with the formulas of steering, the car seems to move without a problem but I am not able to turn the face of the car like the direction of move. I have read several solutions and one of them was to create a 'joint distance' and apply the steer vector to the form that is in front of car

car --- little shape
O----o

I aply the steer vector to the little shape...

... but the car behaves as if it were connected to a spring.

Someone can help me, there is a way to 'connect' two bodies rigidly?

Someone interested in implementing the rest of formulas opensteer?
Attachments
steering.love
Steering example
(20.27 KiB) Downloaded 146 times

User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: Steering to move characters

Post by TechnoCat » Mon Aug 03, 2009 1:11 am

You don't connect two bodies together rigidly. You can join them together with a joint. You can however create two shapes and apply them to the same body. Then they will be one rigid body.

paclito
Prole
Posts: 35
Joined: Wed Apr 22, 2009 8:33 pm

Re: Steering to move characters

Post by paclito » Mon Aug 03, 2009 9:05 pm

Ok I've see how to attach bodies...... but the center of mass not displaces, it's ever on the center of the object
snif snif :....-)

I'm thinking in move the car like a 'horses car' , i'll put a 'horse' in front of the car and two 'threads' or 'rope' to move the car ahead....... I'll post tthe results...... or I'll turn crazy

User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: Steering to move characters

Post by TechnoCat » Mon Aug 03, 2009 9:16 pm

You can automatically determine the center of mass of a body with multiple shapes by using setMassFromShapes()
You can see it being used in the physics example at the bottom.

This is taken directly from the tutorial:

Code: Select all

-- Calculate the mass of the body based on attatched shapes. 
-- This gives realistic simulations. 
body:setMassFromShapes()

paclito
Prole
Posts: 35
Joined: Wed Apr 22, 2009 8:33 pm

Re: Steering to move characters

Post by paclito » Tue Aug 04, 2009 9:52 pm

I've tried this but without succes, my horses car goes crazy...... jejejeje :-)

when it turns correct I'll upload here

Thanks to all and good programming

arggggggg the steering makes me crazy
Attachments
steering2.love
(30.11 KiB) Downloaded 115 times

Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests