banking

Blitz3D Forums/Blitz3D Beginners Area/banking

stayne(Posted 2006) [#1]
how would i bank a spaceship model left or right depending on the speed the mouse is moving left to the left or right? i want it to bank 90 degrees at the most. i can't seem to get results with rotateentity, turnentity or rotatemesh. here's my current moveplayer function (still in it's early stages):
Function moveplayer()
	px# = px# + MouseXSpeed() * .005
	py# = py# + MouseYSpeed() * .005
	px# = px# * .9
	py# = py# * .9
	
	MoveEntity player,-px,0,py
	
	MoveMouse centerx,centery
End Function



Stevie G(Posted 2006) [#2]
The above function has nothing to do with rotations ?!

Best to create a pivot then parent the Player to this pivot. You can then perform the yaw rotation on the pivot and the roll rotation to the Player.

The just ensure that the entityroll( Player ) is >-90 and < 90 degrees.

I'll show you what I mean later if you explain what type of game you are doing.

Stevie


stayne(Posted 2006) [#3]
a vertical shooter. i know b3d well, i guess i'm just having a blank moment. same concept as the shot below, hope this helps.




jhocking(Posted 2006) [#4]
In general Stevie's approach would be a good way, but for the sort of gamestyle depicted just use TranslateEntity for all of the ship movements and then you can rotate however you want without affecting the movement.


stayne(Posted 2006) [#5]
thanks all...

this seems to work halfway decently but the model is rotated around on the Y axis 180 degrees. hmm. also, entityroll limiting isn't working, it's still rolling over.

Function moveplayer()
	
	xm = MouseXSpeed()
	xy = MouseYSpeed()
	xs = xs + xm
	xs = xs * .9
	
	px# = px# + xm * .005
	py# = py# + xy * .005
	px# = px# * .9
	py# = py# * .9

	TranslateEntity player,px,0,-py

	If EntityRoll (player) > -90 Or EntityRoll (player) < 90
		RotateEntity player,0,0,-xs
	EndIf

	MoveMouse centerx,centery
	
End Function



stayne(Posted 2006) [#6]
ok, everything's working great! Hope someone finds this useful. note: for some reason i have to rotate the player 180 degrees on the Y axis (see rotateentity below).

Function moveplayer()
	xm = MouseXSpeed()
	xy = MouseYSpeed()
	xs = xs + xm * .14
	
	px# = px# + xm * .003
	py# = py# + xy * .003
	px# = px# * .9
	py# = py# * .9
	
	If xs > -90 And xs < 90
		RotateEntity player,0,180,xs
		xs = xs * .9
	EndIf
	
	If xs < -90
		xs = -90
	Else If xs > 90
		xs = 90
	EndIf
	
	TranslateEntity player,px,0,-py

	MoveMouse centerx,centery
End Function