News: Welcome back to Bullworth! If you haven't already, you will need to reset your password..


Author Topic: SA Dead Camera hlep  (Read 1121 times)

0 Members and 1 Guest are viewing this topic.

Offline Ming

  • Full Member
  • ***
  • Posts: 154
  • Gender: Male
  • 抽刀斷水水更流,舉杯消愁愁更愁
    • View Profile
SA Dead Camera hlep
« 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
« Last Edit: January 21, 2022, 06:29:18 AM by Ming »

Offline Ming

  • Full Member
  • ***
  • Posts: 154
  • Gender: Male
  • 抽刀斷水水更流,舉杯消愁愁更愁
    • View Profile
Re: SA Dead Camera hlep
« Reply #1 on: January 19, 2022, 08:27:39 PM »
I use simple harmonic motion to set the camera position btw

Offline RBS ID

  • Jr. Member
  • **
  • Posts: 67
  • Gender: Male
  • I don't know.
    • View Profile
    • This is website title.
Re: SA Dead Camera hlep
« Reply #2 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.
« Last Edit: January 20, 2022, 11:06:36 AM by RanggaBS »

Offline Ming

  • Full Member
  • ***
  • Posts: 154
  • Gender: Male
  • 抽刀斷水水更流,舉杯消愁愁更愁
    • View Profile
Re: SA Dead Camera hlep
« Reply #3 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