Jump to content

Camera Roll


stef538

Recommended Posts

Hey, I want to know if it is possible to let the camera roll from one point to the other.

Link to comment
Share on other sites

LordOfTheBongs

set the camera's rotation with a vector3 that you adjust the Y value

 

 

camera.Rotation = new Vector3(camera.Rotation.X, camera.Rotation.Y + yAdjust, camera.Rotation.Z);
Link to comment
Share on other sites

that's not doing the trick..

 

I'm sorry if i was a bit vague, i meant something like this

 

From one ped, to the player.

 

(Example)

If i press R then he creates the ped, and i want the camera to roll from the player's position to the ped's position like a smooth camera animation

Link to comment
Share on other sites

well, basically you need to move the camera, when you say Roll you give the impression of change the Roll component of the rotation hehe:

define initial pos:

dim iniPos as vector3 = yourCam.position

defines final pos:

dim finPos as vector3 = yourTargetPed.position - yourTargetPed.direction * 2

calculates the direction:

dim tmpDir as vector3 = vector3.normalize(finPos - iniPos)

then move camera until it get close to finPos and change camera direction to keep pointing to the ped:

while (yourCam.position.distanceto(finPos) > 0.5)yourCam.position += tmpDir * 0.1wait(10)yourCam.direction = vector3.normalize(yourTargetPed.position - yourCam.position)end while

this is just a basic idea, need improvement.

 

maybe is possible make the game do it for you using native calls, but i dont know how they do.

Link to comment
Share on other sites

well, basically you need to move the camera, when you say Roll you give the impression of change the Roll component of the rotation hehe:

 

define initial pos:

dim iniPos as vector3 = yourCam.position

defines final pos:

dim finPos as vector3 = yourTargetPed.position - yourTargetPed.direction * 2

calculates the direction:

dim tmpDir as vector3 = vector3.normalize(finPos - iniPos)

then move camera until it get close to finPos and change camera direction to keep pointing to the ped:

while (yourCam.position.distanceto(finPos) > 0.5)yourCam.position += tmpDir * 0.1wait(10)yourCam.direction = vector3.normalize(yourTargetPed.position - yourCam.position)end while

this is just a basic idea, need improvement.

 

maybe is possible make the game do it for you using native calls, but i dont know how they do.

 

Well this works thanks!!

But the camera gets under the world. anyway to fix that ?

Link to comment
Share on other sites

my final position is right, but the camera spawns like 200 meters away, and it goes from under the world to the ped...

Link to comment
Share on other sites

LordOfTheBongs

when u say u want the camera to roll that means u want the camera to... "roll"

 

looks like u want the camera to travel from one point to another...

 

just use a tick event to have the travel in the direction of the camera... since the tick is fast and to make movement smoothe, multiply the direction by a number in between 0 - 1

 

here i was bored and wrote u a test script

 

 

namespace CamTravel{    using System;    using System.Windows.Forms;    using GTA;     public class Main : Script    {        private Ped targetPed;        private Camera camera;         public Main()        {            camera = new Camera();             BindKey(Keys.R, delegate            {                if (camera.isActive) return;                 targetPed = World.CreatePed(Game.LocalPlayer.Character.Position.Around(25f));                                camera.Position = Game.LocalPlayer.Character.Position + Vector3.WorldUp * 3f;                camera.LookAt(targetPed);                 Tick += CamTravelTick;                 camera.Activate();            });        }         private void CamTravelTick(object sender, EventArgs e)        {            if (!Game.Exists(targetPed) || camera.Position.DistanceTo(targetPed.Position) < 0.5f)            {                camera.Deactivate();                Tick -= CamTravelTick;                return;            }             camera.Position += camera.Direction * 0.1f;        }    }}
Edited by LordOfTheBongs
Link to comment
Share on other sites

and dont forget to set the initial camera position, if its coming from underground its because it was there on the beggining of movement

Link to comment
Share on other sites

This worked!!! exactly what i was looking for! Thanks!!!!

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.