i need help! my objects arn't bouncing!
the object is that this particulare object bounces, though i want to keep the integraty of the TRANSLATE function! rather than aligning to vectors and move in the z position
i cant get my head around it :(
couljd anyone help?
Velocity# = Sqr(lpPr\VelX#^2 + lpPr\VelY#^2 + lpPr\VelZ#^2)
If Velocity>0
Direction_X# = lpPr\VelX# / Velocity#
Direction_Y# = lpPr\VelY# / Velocity#
Direction_Z# = lpPr\VelZ# / Velocity#
Air_Friction_Force# = AIR_FRICTION_CONSTANT# * Velocity#^2.0
Velocity# = Velocity# - (Air_Friction_Force# )
lpPr\VelX# = Direction_X# * Velocity#
lpPr\VelY# = Direction_Y# * Velocity#
lpPr\VelZ# = Direction_Z# * Velocity#
lpPr\VelY# = lpPr\VelY# - (GRAVITY# )
lpPr\OldY# = EntityY(lpPr\lpModel,1)
TranslateEntity lpPr\lpModel, lpPr\VelX#, lpPr\VelY#, lpPr\VelZ#, True
lpPr\curY# = EntityY(lpPr\lpModel,1)
a1# = lpPr\lprojectPitch
a2# = (lpPr\curY - lpPr\oldY)
fireang# = ATan2(a1#,a2) * 4
yaw# = EntityYaw(lpPr\lpmodel)
;RotateEntity(lpPr\lpModel, fireang,yaw#,0)
TurnEntity lpPr\lpModel,Sin(EntityPitch(lpPr\lpModel))*8,Cos(EntityRoll(lpPr\lpModel))*8,8
; tha above code MUST stay
;RotateMesh
thit% = EntityCollided(lpPr\lpModel,coll_world) ; world collision actors
If thit<>0 Then
vx#=0.0:vy#=0.0:vz#=0.0
For c% = 1 To CountCollisions(lpPr\lpmodel)
nx# = CollisionNX(lpPr\lpModel,1)
ny# = CollisionNY(lpPr\lpModel,1)
nz# = CollisionNZ(lpPr\lpModel,1)
VdotN# = lpPr\VelX# * Nx + lpPr\VelY# * Ny + lpPr\Velz# * Nz
NFx# = -2.0 * Nx * VdotN
NFy# = -2.0 * Ny * VdotN
NFz# = -2.0 * Nz * VdotN
lpPr\VelX# = lpPr\VelX# + Nfx
lpPr\Vely# = lpPr\Vely# + Nfy
lpPr\Velz# = lpPr\Velz# + Nfz
;Vy = Vy + Nfy
;Vz = Vz + Nfz
Next
;AlignToVector lpPr\lpModel, lpPr\VelX#, lpPr\Vely# , lpPr\Velz# , 3, 1
End If
thit% = EntityCollided(lpPr\lpModel,coll_tank) ; it hit a tank (opponent)
If thit<>0 Then
End If
; update Buller Life -----------------------------------
lpPr\life# = lpPr\life# - 1
If lpPr\life#<-256 Then
If ChannelPlaying(lpPr\lschan[0]) Then StopChannel(lpPr\lschan[0])
FreeEntity(lpPr\lpModel)
Delete lpPr
End If
EndIf
|