stef538 Posted April 1, 2014 Share Posted April 1, 2014 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 More sharing options...
LordOfTheBongs Posted April 1, 2014 Share Posted April 1, 2014 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 More sharing options...
stef538 Posted April 2, 2014 Author Share Posted April 2, 2014 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 More sharing options...
julionib Posted April 2, 2014 Share Posted April 2, 2014 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. stef538 1 Link to comment Share on other sites More sharing options...
stef538 Posted April 2, 2014 Author Share Posted April 2, 2014 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 More sharing options...
julionib Posted April 2, 2014 Share Posted April 2, 2014 check if your final position is correct Link to comment Share on other sites More sharing options...
stef538 Posted April 2, 2014 Author Share Posted April 2, 2014 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 More sharing options...
LordOfTheBongs Posted April 2, 2014 Share Posted April 2, 2014 (edited) 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 April 2, 2014 by LordOfTheBongs stef538 1 Link to comment Share on other sites More sharing options...
julionib Posted April 2, 2014 Share Posted April 2, 2014 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 More sharing options...
stef538 Posted April 2, 2014 Author Share Posted April 2, 2014 This worked!!! exactly what i was looking for! Thanks!!!! LordOfTheBongs 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now