Bully-Board

Bully Modding Section => Modding Questions/Help => Topic started by: Ming on January 19, 2022, 08:24:48 PM

Title: SA Dead Camera hlep
Post by: Ming on January 19, 2022, 08:24:48 PM
Code: [Select]
DeadCamera = function()
  if IsButtonBeingPressed(2, 0) then
    StarDeadTime = GetTimer()
    repeat
      TIME = (GetTimer() - StarDeadTime)/1000
      DeltaX = r*math.cos(AngularVelocity*TIME + Angle0)
      DeltaZ = TIME*ZConstant
      gPX, gPY, gPZ = PedGetPosXYZ(gPlayer)
      CameraLookAt = gPX, gPY, gPZ + 1.5
      CameraPosition = gPX + DeltaX, gPY + 1, gPZ + 2 + DeltaZ
      CameraSetXYZ(CameraPosition, CameraLookAt)
      Wait(0)
    until GetTimer() - StarDeadTime > 5000
    CameraLookAtPlayer()
  end
end
It doesn't work
Title: Re: SA Dead Camera hlep
Post by: Ming on January 19, 2022, 08:27:39 PM
I use simple harmonic motion to set the camera position btw
Title: Re: SA Dead Camera hlep
Post by: RBS ID on January 20, 2022, 07:02:00 AM
r, AngularVelocity, Angle0, YConstant variables is not defined(nil) and you're trying to operate it with arithmetic operation.

Correct me if I'm wrong.
Title: Re: SA Dead Camera hlep
Post by: Ming on January 21, 2022, 06:32:20 AM
r, AngularVelocity, Angle0, YConstant variables is not defined(nil) and you're trying to operate it with arithmetic operation.

Correct me if I'm wrong.
Thank you, but I fined it in main function
Code: [Select]
function main()
  Wait(500)
  r = 3
  AngularVelocity = 30
  Angle0 = 0
  ZConstant = 1
 
  while true do
    DeadCamera()
    Wait(0)
  end
end