Re: Car physics
Posted: Sun Apr 24, 2016 6:34 am
@Psychophanta, if you are searching for a car then this car by Guillot in the french forum is very good http://purebasic.fr/french/viewtopic.ph ... 049159b62d , i just find it a few days ago, it has a springy wheels, i haven't studied it yet, the short code is always hard to decipher, it is like a zipped file.
to check physical effects such as adding additional weight try it with these changes:
in line 51: change SetEntityCollisionFilter(0, 1,2) to SetEntityCollisionFilter(0, 1,3) to allow the cubic weight to collide with the car and stay over it.
after line 80 add this cubic weight:
If KeyboardReleased(#PB_Key_Space)
CreateCube(220,0.2)
CreateEntity(220, MeshID(220), MaterialID(2),EntityX(0),EntityY(0)+1,EntityZ(0))
CreateEntityBody(220, #PB_Entity_ConvexHullBody, 1, 0.1,2)
SetEntityCollisionFilter(220, 1,3)
EndIf
now when you press space a cubic weigh will fall over the car and stay over it to test its behavior and other tricks.
for more info about SetEntityCollisionFilter look title : Entity Collision Filter and collision Mask http://purebasic.fr/english/viewtopic.p ... er#p466157
to check physical effects such as adding additional weight try it with these changes:
in line 51: change SetEntityCollisionFilter(0, 1,2) to SetEntityCollisionFilter(0, 1,3) to allow the cubic weight to collide with the car and stay over it.
after line 80 add this cubic weight:
If KeyboardReleased(#PB_Key_Space)
CreateCube(220,0.2)
CreateEntity(220, MeshID(220), MaterialID(2),EntityX(0),EntityY(0)+1,EntityZ(0))
CreateEntityBody(220, #PB_Entity_ConvexHullBody, 1, 0.1,2)
SetEntityCollisionFilter(220, 1,3)
EndIf
now when you press space a cubic weigh will fall over the car and stay over it to test its behavior and other tricks.
for more info about SetEntityCollisionFilter look title : Entity Collision Filter and collision Mask http://purebasic.fr/english/viewtopic.p ... er#p466157