Is there a way to make a camera follow a windy path as the character moves?


(Camos1011) #1

I started with a camera animation for a path that I want to play back and forth as you move the character. Are animations the way to do this or is it a set of logic bricks and objects? I’ve seen a game called AXEL that’s a sidescroller that had a camera follow a character around a spiral ramp. I’ve seen pivot camera rigs that come close but, can’t t think of a way to wind without a track to and a collision methods. Don’t know where to start


(Camos1011) #2

The camera I’m going for looks like the bend around the pathway at the Wind Temple in Mortal Kombat Mythologies: Sub-Zero.

Example is at the 1:26 mark.

And

The underground level at the sewer section of Jackie Chan Stuntmaster.
It occurs at 40:46 mark.


(jesusmora) #3

if the ramp is perfectly circular and there are no other camera changes like it, you can just code it into the camera. but it’s a complex feature.
first, the point at wich the camera looks at will not be the player, but the center of the stairway. you NEED a trackTo method, i would put a property on the stairway wall object with the name of this origin point, then cast a ray from the camera. if it detects this wall, it will change from the normal “state” to a circular stairway mode, it would track to the “origin point” and compensate for the Z position of the player.

EDIT: i tried, maybe someone can help improve it but it’s the best i could do in little time:
2.5d camera3 .blend (455.0 KB)

the Camera is no longer on it’s own, it is parented to an empty called “camera”, this empty will follow “player_horizontal_rotation” and copy it’s movement but keep the smooth transition.
the sairway mode activates when the player walk on an object with a property “stairway”, this property has the name of an empty, that empty will be used as a target for the camera while the player is in the “stairway zone”.
there is a bug with the camera going crazy, i think it has to do with the stairway model having holes in it. you should use a simpler model for collision and and keep stairs as no collision.

good luck.

edit: this can be used for more than just stairs, you can use multiple empties and zones to create more complex movements.


(Camos1011) #4

Woah! Already!? Thanks again @jesusmora !
As you can see, I’m a Midway guy because, they were so creative back in the day.
Just really difficult cameras for me to recreate. :stuck_out_tongue:
From here on out it should be easy given that was the largest of the headaches.
Thank you so much. This community is awesome!


(jesusmora) #5

no problem, i’ve always wanted to code this kind of games.
just found out what the bug was, it happens when the player gets near the border, it just needs a wall to prevent it from falling.


(Camos1011) #6

Actually, I was looking for a way to face intercecting paths but, not everytime though.
Is there a way to make the event more flexible by splitting it up into different scripts?
I like some aspects the way they are but, I want to be able to do something with line 37:

raycas = rotation_object.rayCast(rotation_object.vect1, 10.0, "orbit_object", 0, 1, 0)

Into:

raycas = rotation_object.rayCast(rotation_object.vect1, 20.0, "orbit_object", 0, 1, 0)

Preferably a higher value for 20.0, "orbit_object", 0, 1, 0) but, except separately on it’s own script because, it wasn’t the effect I was looking for to have the camera face the stairs (that I renamed for said flexibility) before climbing them but, perfectly fits going into intercections (just to and from one.) but, not on the left and right. I made a sensor switch (not in this project) where you press left ctrl when you pass over it to handle that. Other such
objects at certain entraces may need to be utilized too. Sometimes enterences would need the facing angle too but, not always at either.

Yeah, it sounds complicated but, I’m just thinking about various transitions and the ability to switch between the two or even get rid of a nature with different combinations and objects.

2.5d camera3 (2).blend (517.6 KB)


(jesusmora) #7

i’m not understanding what you mean. could you show some example like those videos you posted?
i made some changes to the file for the round part, the careful placing of the empties can be used to make all sorts of transitions, but some turns can be difficult or imposible. you want it to do rotate 90º to face a different direction?
i also added a property called “spd”, it MUST be in all objects with the “orbit_object” property, and it controls the speed of rotation. i also removed the default orientation, it no longer defaults to [0.0, 1.0, 0.0] when it does not detect orbit objects, this is useful for smoother transitions because you exit a zone and it keeps the orientation.
i added default orientations (west, east, north, south) the direction is given by the “floor” property, 0 being no orientation (for transitions).
i also added that the camera looks down when the player is falling and there’s nothing to stop the fall.
2.5d camera3 (2).blend (487.2 KB)


(Camos1011) #8

Okay, line 37 does some thing like this when you reach the cylinder.

I turned the value up to 30.0 in the video.
That would be perfect for intersections
I currently have it at 10.0 so that it transitions smoothly into the camera turn only for the stairs.
I love the effect but, just not for the stairs.

Unfortunately, the site wouldn’t let me upload it here directly.


(Camos1011) #9

Okay, I checked out the additions to the project and I really like what I see.
I wasn’t expecting the switches. That’s awesome!
I like the fall camera angle but, just not on every ledge.
It’s more suited for dramatic ledges like at a death drop (dramatic note queue maybe :P) or sneaking overhead on a catwalk in a stealth mission.
Other than that it’s awesome.
Speaking of dramatic, transitioning into and from close ups:

long shots:

tilting transition cameras

and

strafing while facing middle in circular battle rooms:

Already set up an arena room for strafe.

2.5d camera3 (2).blend (550.8 KB)


(jesusmora) #10

zoom was easy. long shots activate when the character is in a floor with a property called “far”.
objects with the property “camclip” can be used for closed areas, to “stick” the camera to a wall. objects with the property “farshot” can be used to limit the camera’s distance during long shots, similar to camclip.
the objects “Limiter” and “Limiter2” are added to set the camera to a default distance when no other objects are in place.
Camera is now parented to an object called “Cam_clip”, wich follows camera, wich follows player_horizontal_rotation.
I fixed the bugs with floor, it was casting a ray upwards instead of downwards. the “fall” camera animation now works correctly. added an example of deathpit object to trigger this effect.
adjusted rotation speed to make it smoother.

transitioning into and out of closeups in dramatic, scripted events should be handled by a different camera, it would take it’s own script and camera waypoints as well as trigger objects.
i don’t understand the tilting transition cameras, an effect of the camera rotating 180º can be achieved by connecting a north and a south zones.
if i understand the last one, you want the character to face a boss? just parent the empty to the boss character.
2.5d camera3 (3).blend (527.2 KB)


(Camos1011) #11

Sorry about the bad example.
As for camera tilt I mean like sometimes when you’re looking down from a high object almost like the fall ledge but, more like looking down at a vista:

and other times like this when descending :


(Camos1011) #12

So when you say that, you mean the speed can’t be adjusted to zoom in or out gradually without triggers right?
What I notice was that a limiter mesh (like the one near the stairs) shaped to transition smoothly into and out of a long shot seems possible but, the long shot has no collision.


(jesusmora) #14

i tried the tilt but it’s becoming too complex. some of the parts on that game would have to be made with a different camera, like when the camera follows from an angle, it would be easier to create a different camera with it’s code to follow the character so that presing A and D it moves over the platform instead of falling. other parts use a camera that moves to preset locations and looks at the character instead of following it (it rotates but does not move), this would have to be ANOTHER camera.
i added a way to make it tilt, follow the empty in 3d instead of flat, but unless i’m looking for an especific movement, i can’t make it work without it going crazy or tilting the wrong way.
when the character walks on a zone with the property “orbit_object”, and an object with the property “floor”, and “floor” has a value higher than 5, it tilts the camera. otherwise it follows the orbit object.
2.5d camera3 (3).blend (531.7 KB)

the cinematic could be made by animating a camera object, then a trigger object would change the camera, start the animation, and put a timer to return to the default camera.

i think there is nothing else to be improved in the script.


Crash Bandicoot fangame (HELP WANTED!)
(Camos1011) #15

Wow! I think you’re right about there being nothing else to improve the script because, anything else would either be impossible or just another variation of of something else already in the script. Okay, thanks so much.
I hope I wasn’t too much of a bother.

You totally earned a credit and a percentage when I sell the final product.
I can’t guarantee when but, I will definitely keep you posted if you’re interested.


(Camos1011) #16

I perfected the stair and far camera tilts.
The long shot now closer resembles the video now.
I added a new line called Far Camera Tilt in floor integer #3 now.
I also found a way to make a top-down camera too (not in project but, will be included in the finished template before finishing the game).
2.5d camera3 final.blend (617.9 KB)