Open fr0zi opened 3 years ago
Maybe an easier way to simulate the wheels: Use only: cpVect cpBodyGetVelocity(const cpBody body) void cpBodySetVelocity(cpBody body, const cpVect value)
And the wheels will be only draw like a sprite without physics behavior. (If you see the weels on screen)
The problem is - I want to make it simulation-ish, not arcade and I want to make wheels to steer and drive the vehicle :) I know that it's possible to achieve with Box2d but I wanted to try with Chipmunk first because I like the API and simplicity. Question is if joints in Chipmunk are able to provide correct behaviour in this case?
Ok. You know each wheel is only a point (line) contact on the street? The direction can be simulate with the direction of the velocity. So maybe you can try to simulate without draw of two boxes which 'show' the wheel as a top view of a wheel (not the contact on the street)
I don't think I'm following. These boxes drawn in place of wheels are just debug shapes of the wheel shapes. Wheels itself are normal physical bodies and I want to make it this way.
Anyway, I maybe found the reason for my problem with joints. I realized that to prevent vehicle to slide to the sides, I killed lateral velocity completely, so I suppose in some cases joints were forced to move from it's anchor point. I changed my calculation and now I'm killing only like 90% of lateral force, giving wheels possibility to adjust their positions a little bit, and now they behave correctly. At least it seems so for now. Issue can be closed.
Thanks for answers.
Hi. This is probably not a bug but I couldn't register on the forum to ask my question (I didn't get an email for account activation) so I will ask here.
I'm working on top-down vehicle simulation game and I want to build a vehicle with physical body as chassis and also physical bodies for wheels. Wheels are connected to chassis body with pin joints. However when I run the game and try to drive a vehicle, wheels are wiggling and front wheels don't hold their positions relative to the chassis. Like in the video below:
https://user-images.githubusercontent.com/606711/140582445-ab6f3996-427e-4d7a-a6df-f3299175ad3a.mp4
Chassis body has a mas of 10 and wheels - mas of 1.
I have a fixed step for physics implemented and it should be fine since I used similar code in some of my previous projects where I used Bullet Physics and it was working fine.
Is there a way to fix wheels to stay in correct positions, as wheels should, or it's just how they work in Chipmunk?
Thanks in advance for help. And thanks for making Chipmunk :) I like it and I hope I will be able to use it in my game.