IMG

 
IMG
IMG   IMG
  Welcome to GTAForums! Be sure to check out the Grand Theft Auto V Forum.

You are not registered! (If you are, click here to login) Registering is fast, free and easy and allows you to instantly reply to any topic on GTAForums.
Why wait? Click here to register your own unique username and become part of the ever-growing community!


( Log In | Register | Revalidate Validation E-mail )
Quick Log-In:
  IMG
       
>
Forum Rules GTA Modification Forums

Please post mod releases in the Mod Showroom

GTAGarage.com
free mod hosting from GTANet, simply login with your GTAForums account details

GTAModding.com
GTANet's modding wiki

GTA Modding Chatroom
provided by irc.gtanet.com (Don't have an IRC client? Click here)


  Reply to this topicStart new topicStart Poll

 Camera Up\Down Left\Right rotation around a point

 
Link2012  
Posted: Tuesday, Sep 4 2012, 13:48
Quote Post


Wut?
Group Icon
Group: Members
Joined: Jan 30, 2011

ba.gif

XXXXX



I have a camera, this camera will always point to a entity, but it needs to be moveable in a circle around the entity, like the basic game camera, that points to CJ and when you move the mouse the camera rotates around the player.

What I did works well only when I have just the movement in Left\Right, when I add the Up\Down things start to be imprecise\buggy

What I've done so far:
CODE
:UpdateCamera
// Move in XY Axis
0656: get_angle 10@ absolute_degrees_to 0@  // Angle in the circle to rotate

02F6: 1@ = sine 0@
006B: 1@ *= CircleRadius
1@ += XCircleCenter
0087: 2@ = 1@

02F7: 1@ = cosine 0@
006B: 1@ *= CircleRadius
1@ += YCircleCenter
0087: 3@ = 1@

// Move in XZ Axis (Buggy) - Comment this and the camera works perfectly, but only in Left\Right
// {
0656: get_angle 11@ absolute_degrees_to 0@


02F6: 1@ = sine 0@
006B: 1@ *= CircleRadius
005B: 1@ += 2@
0087: 2@ = 1@

02F7: 1@ = cosine 0@
006B: 1@ *= CircleRadius
1@ += ZCircleCenter
0087: 4@ = 1@
// }

//......
015F: set_camera_position 2@ 3@ 4@ rotation 0.0 0.0 0.0
0160: set_camera_point_at XCircleCenter YCircleCenter ZCircleCenter mode 2
return


Of course there's a piece of code where I handle the mouse movement... Mouse movement in X Axis I add + to 10@, Mouse movement in Y Axis I add + to 11@.

So... What I'm doing wrong?

This post has been edited by Link2012 on Tuesday, Sep 4 2012, 13:55
PMMSN
  Top
 

 
ZAZ  
Posted: Tuesday, Sep 4 2012, 17:08
Quote Post


Kernlochbohrer
Group Icon
Group: Members
Joined: Jan 10, 2005

eu.gif

Member Award




i'm wondering why you have this in your "not working up/down"
QUOTE
02F6: 1@ = sine 0@
006B: 1@ *= CircleRadius
005B: 1@ += 2@
0087: 2@ = 1@

it would overwrite 2@
you only need cosine for up/down
or sine if you wanna invert the cam
but not both


i don't know when i need 0656:, my cam works in this way.
CODE
{$CLEO .cs}
thread  'CAMCIRC'
8@ = 5.0
16@ = 0.0

while true
wait 0
   if
       0256:   player $PLAYER_CHAR defined
   then
       0172: 4@ = actor $PLAYER_ACTOR Z_angle

           while 0256:   player $PLAYER_CHAR defined
               wait 0
               00A0: store_actor $PLAYER_ACTOR position_to 0@ 1@ 2@
               0087: 9@ = 0@ // (float)
               0087: 10@ = 1@ // (float)
               0087: 11@ = 2@ // (float)
               0A4A: store_joystick_X_offset_to 5@ Y_offset_to 15@
               005B: 4@ += 5@ // (float)
               02F6: 6@ = sine 4@ // (float)
               02F7: 7@ = cosine 4@ // (float)
               006B: 6@ *= 8@ // (float)
               006B: 7@ *= 8@ // (float)
               005B: 0@ += 6@ // (float)
               005B: 1@ += 7@ // (float)
               0063: 9@ -= 6@ // (float)
               0063: 10@ -= 7@ // (float)
               005B: 12@ += 15@ // (float)
               02F7: 13@ = cosine 12@ // (float)
               006B: 13@ *= 8@ // (float)
               005B: 2@ += 13@ // (float)
               0063: 11@ -= 13@ // (float)
               015F: set_camera_position 0@ 1@ 2@ rotation 0.0 0.0 0.0
               0160: set_camera_point_at 9@ 10@ 11@ mode 2
           end
   end
end


Users WebsitePM
  Top
 

 

1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)

0 Members:

Topic Options Reply to this topicStart new topicStart Poll
Search topic for posted by (exact match)



 
IMG IMG