Ok, i've set up a ground and collision, i've made a function to create a ball and know am at the physics part, i've been looking at the formula:
F=MA
A=F/M
But one thing that is puzzeling me is the other formulas cause i'm not sure how to put it into my coding, just so you know how i'm coding this i'll put the code below:
;--------------------Graphics---------------------
Graphics3D 1280,1024,32
SetBuffer BackBuffer()
;--------------------Constants--------------------
Const Ground_Type=1
Const Ball_Type=2
Gravity#=1
;--------------------SetUp------------------------
Camera=CreateCamera()
PositionEntity camera,0,5,-10
Light=CreateLight()
Texture=LoadTexture("Rope.jpg")
Surface=CreatePlane()
EntityTexture Surface,Texture
EntityType Surface,Ground_Type
CreateBall.Physics(0,5,0)
Collisions Ball_Type,Ground_Type,3,1
;--------------------Loop-------------------------
While Not KeyHit(1)
UpdateWorld
RenderWorld
frames=frames+1
If MilliSecs()-render_time=>1000 Then fps=frames : frames=0 : render_time=MilliSecs()
Text 0,0,fps
Flip
Wend
End
Type Physics
Field Entity
Field X#, Y#, Z#
Field VX#, VY#, VZ#
Field AX#, AY#, AZ#
Field Mass#, Weight#, Size#
End Type
Function CreateBall.Physics(X#,Y#,Z#)
Test.Physics=New Physics
Test\Entity=CreateSphere()
Test\X#=X#
Test\Y#=Y#
Test\Z#=Z#
PositionEntity Test\Entity,Test\X#,Test\Y#,Test\Z#
EntityColor Test\Entity,255,0,0
EntityShininess Test\Entity,2
EntityType Test\Entity,Ball_Type
End Function
;F=ma
;S=ut+0.5*a*t*t
;v=u+at
;v*v=u*u+2*a*s
Function Update_Ball.Physics(AX#,AY#,AZ#)
For Test.Physics=Each Physics
Next
End Function
I'm not at all sure what to do next. thanks.
F=MA
A=F/M
But one thing that is puzzeling me is the other formulas cause i'm not sure how to put it into my coding, just so you know how i'm coding this i'll put the code below:
;--------------------Graphics---------------------
Graphics3D 1280,1024,32
SetBuffer BackBuffer()
;--------------------Constants--------------------
Const Ground_Type=1
Const Ball_Type=2
Gravity#=1
;--------------------SetUp------------------------
Camera=CreateCamera()
PositionEntity camera,0,5,-10
Light=CreateLight()
Texture=LoadTexture("Rope.jpg")
Surface=CreatePlane()
EntityTexture Surface,Texture
EntityType Surface,Ground_Type
CreateBall.Physics(0,5,0)
Collisions Ball_Type,Ground_Type,3,1
;--------------------Loop-------------------------
While Not KeyHit(1)
UpdateWorld
RenderWorld
frames=frames+1
If MilliSecs()-render_time=>1000 Then fps=frames : frames=0 : render_time=MilliSecs()
Text 0,0,fps
Flip
Wend
End
Type Physics
Field Entity
Field X#, Y#, Z#
Field VX#, VY#, VZ#
Field AX#, AY#, AZ#
Field Mass#, Weight#, Size#
End Type
Function CreateBall.Physics(X#,Y#,Z#)
Test.Physics=New Physics
Test\Entity=CreateSphere()
Test\X#=X#
Test\Y#=Y#
Test\Z#=Z#
PositionEntity Test\Entity,Test\X#,Test\Y#,Test\Z#
EntityColor Test\Entity,255,0,0
EntityShininess Test\Entity,2
EntityType Test\Entity,Ball_Type
End Function
;F=ma
;S=ut+0.5*a*t*t
;v=u+at
;v*v=u*u+2*a*s
Function Update_Ball.Physics(AX#,AY#,AZ#)
For Test.Physics=Each Physics
Next
End Function
I'm not at all sure what to do next. thanks.