Physics for Stupid People like me

Blitz3D Forums/Blitz3D Beginners Area/Physics for Stupid People like me

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Shawn,

I have some of this Working, and I really appreciate you taking as much time as you did explaining this to me.

These Statments I understand, as I now have my Arrow Moving.

TFormNormal 0, 0, 1, Arrow, 0
Thrust_Nx# = TFormedX()
Thrust_Ny# = TFormedY()
Thrust_Nz# = TFormedZ()

Where does the Gravity Vector come into play. My Code Below is with your help, How do I add the gravity? I want to make sure when my character is heading up a hill, he starts to slide backwards if I apply no forward thrust


gravity#=9.8
Friction#=.5
AngularV#=360
PhysicsTime#=.001
Time=MilliSecs()
Pointer=CreateSphere(8)
ScaleEntity Pointer,.1,.1,.1
EntityColor Pointer,255,0,0
Pointer1=CreateSphere(8)
ScaleEntity Pointer1,.1,.1,.1
EntityColor Pointer1,0,255,0

Repeat
 	 If KeyDown(205) 
			TurnEntity Character\Body,0,-AngularV#*PhysicsTime#,0
			End If
			If KeyDown(203)
				TurnEntity Character\Body,0,AngularV#*PhysicsTime#,0
			End If 
			If KeyDown(57)
			If Not Animating(Character\body) Then Animate Character\Body,3,3,1
				Thrust#=2
 			Else
				Thrust#=Thrust#*.95
			EndIf 

			TFormNormal 0, 0, 1, Character\Body, 0 
			Thrust_NX# = TFormedX() 
			Thrust_Ny# = TFormedY() 
			Thrust_Nz# = TFormedZ() 
			
			TFormNormal 0,-1,0,Character\body,0
			  
			Grav_NX# = TFormedX()  
			Grav_Ny# = TFormedY() 
			Grav_Nz# = TFormedZ() 

			
			Character\Vx# = ( Thrust_Nx# * Thrust#)  + (Grav_Nx#*Gravity#) 
			Character\Vy# = ( Thrust_Ny# * Thrust#)  + (Grav_Ny#*Gravity#) 
			Character\Vz# = ( Thrust_Nz# * Thrust#)  + (Grav_Nz#*Gravity#) 
 
			Character\Speed#=Sqr(Character\VX#^2+Character\VY#^2+Character\VZ#^2)
		  

			
			
			LinePick EntityX#(Character\Body),EntityY#(Character\Body)+5,EntityZ#(Character\Body),0,-10,0,0.2
			TranslateEntity Character\Body, Character\Vx#*PhysicsTime#,Character\Vy#*PhysicsTime# , Character\Vz#*PhysicsTime# 
 			AlignToVector Character\Body,PickedNX#(),PickedNY#(),PickedNZ#(),2,.15
 
			PhysicsTime#=(MilliSecs()-Time)/1000.00
			Time = MilliSecs()
			If Time > F_time Then
				F_Time = Time + 1000
				FPS = Fcount
				fcount = 0
			Else
				fcount = fcount + 1
			End If
	
	Update_Camera(PhysicsTime#)
	
	UpdateWorld	
	RenderWorld  
			;PositionEntity Pointer ,EntityX#(Character\Body)+(Character\Vx#),EntityY#(Character\Body)+(Character\Vy#),EntityZ#(Character\Body)+(Character\Vz#)
			;PositionEntity Pointer1,EntityX#(Character\Body)-(Grav_NX#),EntityY#(Character\Body)-(Grav_NY#),EntityZ#(Character\Body)-(Grav_NZ#) 
	
 

	Text 10,12,Thrust_NX#+" "+Grav_NX#
	Text 10,24,Thrust_Ny#+" "+Grav_Ny#
	Text 10,36,Thrust_Nz#+" "+Grav_Nz#
	Text 10,48,"Entity Yaw"+EntityRoll(Character\body)
	Flip
	     
Until KeyHit(1)




Why Doesn't My character Slide down the slop he is on?
I know you don't have the graphics, but I can climb up a slope but once I get up I can't go back down the slop. It's like gravity on a slop works in reverse.
Regards,
Eric