RotateEntity

Blitz3D Forums/Blitz3D Beginners Area/RotateEntity

BlueWolf(Posted 2004) [#1]
Hi, I have another question as usual

I am trying to rotate an entity to the left and right a but without going to far in each direction, so that it looks like the entities are wiggling

Function UpdateBlocks()

	For block.block= Each block
	
		yaw=Cos(180);this is the bit that rotates the blocks
		
		RotateEntity block\blck,0,yaw,0
		
			If EntityYaw(block\blck)>Cos(90)
				yaw=yaw-yaw*2
			   Else
				yaw=Cos(180)
			EndIf
					
	Next

End Function 


The problem is that the blocks won't rotate at all?? :/

Also I realize I am probably not using the cosine stuff right so excuse my math :)

Thanks


Ross C(Posted 2004) [#2]
All you need to do is put the angle in the rotateentity.

RotateEntity cube,90,0,0

rotate 90 degrees on the x Axis.

Does this help?


BlueWolf(Posted 2004) [#3]
Well that works kind of

Function UpdateBlocks()

	For block.block= Each block
	
		x=45
			
		If EntityPitch(block\blck)<>45 
			x=x-x*2
		Else
			RotateEntity block\blck,x,0,0
			
		EndIf
					
	Next

End Function 					 
		


but the blocks only rotate once ie. 45 degrees to the right. This little breakout clone is starting to become very aggravating :-)


Graythe(Posted 2004) [#4]
Hi BlueWolf,

There are two commands to rotate entities. The most obvious is ROTATEENTITY. It rotates an absolute angle from Zero degrees of rotation. So - "RotateEntity MyCube,90,0,0" will appear to work only once if called many times in strict succession.

The other command is TurnEntity - this rotates an entity relative to it's current rotation - so TurnEntity MyCube,1,0,0 will continually rotate the entity about it's x axis. Personally I find this the more handy of the two commands.

I hope it helps,


BlueWolf(Posted 2004) [#5]
Ahh I have not seen TurnEntity before. Thankyou for this helpful tidbit Graythe.