on launching it is giving error a is null
One major problem here is that you haven’t created a physics world. On your root entity, create a script component and then create a p2World
script on it.
1 Like
I see. Thank you
1 Like
Now the vehicle falls right through the plane. Do i have to make the plane a rigid body?
It’s because:
- You have the Physics World set to the XY plane. Your game is in the XZ plane. So use that.
- You have gravity set to [0, -9.8]. But for your game. you don’t want gravity so set it to [0, 0].
These are the World settings in my screenshot further up (taken from the car demo in the p2.js integration project).
Oh, now i get it. Really appreciate your help. One more thing, where is the option to change default position of car? I can see that the position changes once the game starts.
I’m not sure I understand the question. By ‘default position of car’ do you mean the place where the car starts? That should be the same place as in the Editor.