How would you animate a wheel in this situation?

Hello,

I finally figured a way to make the wheels stick to my vehicle while turning, and also have the wheel’s physics not interfere with the vehicle’s physics by using Ctrl+J and joining them together.

I’m now having a different problem, though because I’m not sure how I can animate the wheels. If I were in object mode and each wheel was selectable then I could assign a logic brick to each individual wheel to make it turn, but because I joined the wheels with the vehicle’s body, I’m not able to assign logic bricks to them in edit mode.

Any advice on what to try next? :spin:

Never done something like this, but my idea would be Armature - One bone for each wheel, paint them in weight-paint and turn them as an animation.
But shouldn’t it work with parenting the wheels with the car? :open_mouth:

If you join the wheels with Ctrl+J to the car, the result is one object, so you can only add one physic and one logic briks. If you realy want to do it in logic briks try to add the weels with the constrain actuator. But I think it is better to use a python script. Here you can find a tutorial http://www.tutorialsforblender3d.com/Game_Engine/Vehicle/Vehicle_2.html.

Hello, everyone.

hundi, I tried parenting the car to the wheels but the wheels had trouble follwing it whenever it turned. I like your armature idea, though. I’ll try it and report back.

HG1, I’m using Blender 2.55 right now and the python script in your link doesn’t work on it. Besides, I’m aiming for realism and its crucial that the tire physics don’t interfere with the car physics and have good collision detection, so I don’t mind combining them into one object.

Oh, and I’ve also tried using shape keys to make the individual wheels turn in edit mode but that doesn’t work either. It seems that shape keys only have the ability to affect an object’s shape, lol!

I’ve also tried animating the tires manually instead of using logic bricks , but it seems that you can’t insert key frames either in edit mode, in order to move the tires.

If anyone has a simpler method than using armature, then please share it.

Here some links with a script that works on Blender 2.55.
Camaro 2.5x.blend (840 KB)
http://mikepan.com/files.php Racer25.zip
http://www.blender3dclub.com/index.php?name=Downloads&req=MostPopular Hummer22.zip

Attachments

VehicleFinished_25x.blend (809 KB)

these are very useful…a little misguiding though.
When i was opening up the “camaro 2.5x.blend” i was hoping for a mid-poly camaro model, but damn
the actual model blew me out of my expectations!

Alright after a lot of trial and error, It doesn’t seem that joining the tires and the car itself into one object was the best solution, since it created a lot of unforeseen problems.

So far I’ve attached a single bone to a tire, weight painted the tire, made the tire the parent of the car and then added a motion actuator to the bone, but that moved the whole car even though I only weight painted the tires. After that, I animated the tires and then used an action actuator to run the animation, it worked but the car is now parented to the bone which means that there still will be physics interference between them! :frowning:

HG1, thanks for the links. I’ve actually done a lot of googling before making this topic, and only the Racer25.zip file was known to me before you posted it.

I wanted to make a car with good physics without python but it seems like there is no escaping it. It’s not so bad, though cause now know I have a lot of source code to aid me :yes:

Hi, guys.

I’d like to know how to use my very own car model using this same setup and scripts as used in this VehicleFinished_25x.blend file as attached:

Attachments

car.blend (1.26 MB)

Here is it.

Attachments

VehicleFinished_257.blend (1.04 MB)

THANK YOU VERY VERY MUCH MY FRIEND !!!
THIS IS LIKE ONE OF THE BIGGEST PRESENTS I’VE RECEIVED FOR THE WHOLE OF THIS YEAR !!!
THANK YOU AGAIN.

Tell me, can you maybe explain to me how you got it adapted with my car model ?
I tried and followed many tutorials on that, but without any success.

I checked out tutorialsforblender3d and a few others too.

That was easy.

  1. Append your car in my old VehicleFinished_25x.blend.
  2. Scaling the car a little bit up to the size of the original car.
  3. Press CTRL+A and apply the scaling (for the physic the scaling must be x:1.000 y:1.000 z:1.000).
  4. Select the new car then shift select the old car (with logic bricks) then press space key and type in Copy and select Copy Logic Bricks to Selected.
  5. Change all physic attributes on the new car (Rigid Body, No Sleeping, Mass: 200.000, Damping Translation: 0.032, Damping Rotation: 0.188, Collisions Bounds, Convex Hull)
  6. Set up the tire position.
    tire_0_Pos = [ -1.7, 2.9, -0.5] # front driver’s tire
    tire_1_Pos = [ 1.7, 2.9, -0.5] # front passenger’s tire
    tire_2_Pos = [ -1.7, -3.0, -0.5] # rear driver’s tire
    tire_3_Pos = [ 1.7, -3.0, -0.5] # rear passenger’s tire
    That was all.

Just look at the Vehicle Wrapper for non programmer.
There is no need to even touch the python code.
There is no need to write down the position of the wheels.
Just editing some properties - maybe editing some LB to customize the controls.
It should be easy to adapt it to your model.

Monster

Thank you very much for your reply too.
I had a look at it and like it a lot, especially the drifting part.

Can I use your scripts and stuff for my own commercial game ?

The original script is form http://www.tutorialsforblender3d.com/Game_Engine/Vehicle/Vehicle_2.html and released under the Creative Commons Attribution 3.0 Unported License http://creativecommons.org/licenses/by/3.0/. I only changed the code form Blender 2.49b to Blender 2.5x.

Will this setup be good enough to get my game working with AI and network playing ?

It is a basic car physic setup. If you want a more realistic car physic you can change some values like Tire_Grip, Suspension_Compression, Suspension_Damping, Suspension_Stiffness, Roll_Influence and so on.
It the same like Monsters vehicle wrapper. But Monsters vehicle wrapper is a little bit easier to setup, it use only one value for all wheels. For the other vehicle wrapper you have to change it for each wheel.

O’h ok. Thank you. I appreciate your advise.
And is it possible to tweak the scripts to make my car drift etc ?
And what about wheels spinning ?

Both methods basicly accesses the VehicleWrapper which provides an easy API to a vehicle physics model.

For drifting and spinning, you should play with the friction parameters of the wheels. I think there are a lot of params to play with. You need to find out what setup fits best for you. You can even create cars with different behaviour.

BTW. mass and center of the vehicle object has influence on the car’s behaviour too!

Ok, thanks for the info.
I’ll try and see what will work best for me.
I still want to learn python so I can make my own custom setups etc.
But I guess it’s gonna take some time.
At the moment as HG1 converted my car to be drivable, it rolls over when turning at high speed. How can I change this ?

I assume the rear wheels give to much power under the vehicles center. Try to lower the center or reduce the forces on the rear wheels. There might be other solutions, but I do not know them.

I set the center of the car 1.5 blender units down.

  1. Tab for edit mode.
  2. CTRL+A to selct all vertices.
  3. N to open the properties window.
  4. Under Transform Location: you can change the Z value.
  5. Change in the script CarSetup.py the tire position.

Attachments

VehicleFinished_257.blend (1.04 MB)

Thank you. I got it.
Now I can start to see how the python script stuff works.
Do you perhaps know how I can make my car’s front wheels spin as if I’m pulling away too fast like in drag racing ?
And what about picking up something you drive over which gives you a nitro’s boost ?

Look at this guys demo test vid ?
http://www.youtube.com/user/MultiMegaSpeed#p/u/23/JmdkioQdcSU

The physics seems extremely good.
And this is what I want to achieve with this car game.