Jump to content

Normal Train camera


DakiLLa

Recommended Posts

What camera do you think about? Do you mean "cinematic" one which changes from time to time?

Maybe in dp3 it would look smoother (using onClientPreRender) then in dp2 (using onClientRender).

Link to comment

i have been working on a special camera for when u do jumps but im not sure if its quite what u need

do u want the camera to follow the train like it does in a car or do u want a cinematic camera like 50P mentioned

there are a lot of issues with the camera functions at the moment ( i have heard they should be fixed in DP3 but nothing certain yet ) if u set the camera to a fixed position then set it to look at the player it causes the world to become un solid ( you fall through the ground ) and if you use onClientRender the camera becomes very twitchy and frame rate seems to drop considerably

https://forum.multitheftauto.com/viewtopic.php?f=91&t=23086

if u look at this thread TMA has posted a workaround for the problem of falling through the world but this script puts the camera in a fixed position and then looks at the player so i dont know if it will be any use to you

if u want camera to follow the train u could probably use getElementposition of the player and keep moving the camera according to where the train is but it would still be a lot like the cinematic camera. i dont know if this can be adapted to follow the train closely but its probably worth a try

Link to comment

there are a lot of issues with the camera functions at the moment ( i have heard they should be fixed in DP3 but nothing certain yet ) if u set the camera to a fixed position then set it to look at the player it causes the world to become un solid ( you fall through the ground ) and if you use onClientRender the camera becomes very twitchy and frame rate seems to drop considerably

if u look at this thread TMA has posted a workaround for the problem of falling through the world but this script puts the camera in a fixed position and then looks at the player so i dont know if it will be any use to you

TBH, I've never stumbled on such issue. I've had camera rotating around a player and I could walk normally, I could enter a vehicle and drive it with rotating camera.

Link to comment

the script from tma sorts out the falling through the world problem but when i first tried setting the camera position and then set camera look at player if u drove or walked a little way past the camera u would start falling through the world

at the time i was trying to make what i call a thrillcam which when u jumped off a ramp u would hit a collision sphere at the top of ramp camera would be fixed about 20 - 30 feet in front of you and would watch the car as it did the jump and then switch back to normal. that part worked fine but if u drove another 50 feet or so then u would fall through. there was also an issue where the camera position would only be put in the right postion every other time i tried to change it. when u hit collision sphere to trigger camera change the first time the camera would be set to position 0, 0, 0 but the second time it would put the camera where i wanted it and third time it would be 0, 0, 0 again and fourth would put camera in the right place. i tried the script about 30 times in a row and kept getting same result. i put some screenshots in the thread that i linked to earlier. im not really sure how TMA got around it but with the script he gave me it is no longer a problem. i have seen your MODSHOP resource 50P ( very cool :D ) so i know what u mean about the rotating camera and i must admit i did look through your script when i was trying to figure out how to do my thrillcam but in the end TMA helped me out as im a pretty NOOB scripter

Link to comment

I played with the cameras more after that but could never:

(a) Get rid of twitchy looking movement when speccing yourself in a car. It all works fine (it was based on what I posted in the other thread) but is never smooth. Maybe onClientPreRender sorts this.

(b) Stop it falling through the floor at distance when you move the camera too far away. I've sorted this by setting the players velocity to 0,0,0 while spectating - unless there's a better way ?

There are certain things you can do with the camera on the same frame - as 50p mentioned setting the position and look-at direction is OK, but other combinations aren't. I altered your code to include timers so that mode changes and movement/target weren't on the same frame. If you try to go fixed mode and move/lookat something in the same frame it seems to fail and look in the wrong direction.

You could try over-riding the camera while using the train - haven't tried - but did try when you're deading with the floating camera - that seemed to keep resetting.

Link to comment

There are certain things you can do with the camera on the same frame - as 50p mentioned setting the position and look-at direction is OK, but other combinations aren't. I altered your code to include timers so that mode changes and movement/target weren't on the same frame. If you try to go fixed mode and move/lookat something in the same frame it seems to fail and look in the wrong direction.

That's why you should toggleCameraFixed mode and then add handling function to onClientRender, so it shouldn't be looking in the wrong direction.

I've played with cams a bit too. I can't remember when exactly but when I tried to set camera position for the 1st time it was set to 0,0,0 but the next time camera was set to the position that was previously called. It was set to the previous position every time after that.

Link to comment
That's why you should toggleCameraFixed mode and then add handling function to onClientRender, so it shouldn't be looking in the wrong direction.

I've played with cams a bit too. I can't remember when exactly but when I tried to set camera position for the 1st time it was set to 0,0,0 but the next time camera was set to the position that was previously called. It was set to the previous position every time after that.

Yeah but there's nothing in the function's Wiki to highlight the camera issues - that of delaying setting position/target. If you are doing stuff like a camera rotate round a fixed point, it's something people wouldn't notice (it failing the first time and being fine from then on). It's just that the first time I wanted to do camera stuff, I just wanted to set a position and angle and made the mistake of trying mode change/move/target all in one frame. Hence the timers in the code I wrote for the other thread. I now have a better system that does run on the client render.

Link to comment

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...