A simple solution is to set the angular velocity of the box to zero every loop, thus not allowing the object to actually rotate but will still move.
sync on
sync rate 60
phy start
make object cube 1,20
scale object 1,100,150,100
phy make rigid body dynamic box 1
make object box 2,200,1,200
position object 2,0,-30,0
phy make rigid body static box 2
color object 1,rgb(128,128,0)
color object 2,rgb(0,128,200)
do
`controls
if upkey() = 1 then phy add rigid body local force 1,0,0,40,5
if downkey() = 1 then phy add rigid body local force 1,0,0,-40,5
if leftkey() = 1 then phy add rigid body local force 1,-40,0,0,5
if rightkey() = 1 then phy add rigid body local force 1,40,0,0,5
if spacekey() = 1 and spkey = 0
phy add rigid body local force 1,0,20,0,2
spkey = 1
endif
if spacekey() = 0 and spkey = 1 then spkey = 0
`block the angular velocity
phy set rigid body angular velocity 1, 0, 0, 0
`Enable this if you want no rotation at all
` phy set rigid body rotation 1, 0, 0, 0
phy update
sync
loop
Additionally, you can also set the rotation to zero but this may create problems.
Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why.
Programmers combine theory and practice: Nothing works and they don't know why.