Ultimate Zelda lock on camera!

Posted By: DavidLancaster

Ultimate Zelda lock on camera! - 11/24/06 22:43

Got this nice lock on camera working with the Kingdom Hearts code and wanted to share. As far as I can tell it's the same camera as in Zelda: Ocarina of Time. The goal was to keep the lock on target and the player in view at all times but also have the camera avoid clipping walls and have a nice angle on the scene. Lock onto a target high up in the air or below you and the camera will move accordingly Here is the download:

http://www.churness.com/axys/ZeldaLockOn.zip (link should work, if it doesn't read posts below incase url has changed)

All resources in this project are free for you to use in any commercial project. Things are unpolished and the code, even though built upon the Kingdom Hearts code, will have some additions that may be difficult to understand, so use and attempt to understand at your own risk There are plenty of things that could be added to this, I just wanted to show you the lock on code I used 6.5, may be compatible with 6.4, not compatible with 6.3 (due to using time_step etc). Good news is that the models are using ellipoid c_move and c_trace The collision model is separate to the animated model, this is because I run into collision issues when two models collide if they are complexly designed like characters with ellipoid collision, a simple box doesn't run into such issues (ie getting stuck when you touch another entity) so this added a new complexity to the code having to have two functions, one which handles the movement but also needs to control the animation of another entity.

When you are locked onto a target (right click), you can switch to another target in view (and with an arrow on it's head), by right clicking again, this only locks on to the nearest target which is in view and is not the one you are currently locked onto, it wont scroll through all the targets on screen. If more than one target is in view hold S and right click to break the lock on. The jumping is automated from walking off a ledge. And if you hold right click and move you can kind of see the beginnings of what happens when you hold Z when playing Ocarina (although needs to be refined more as the camera doesn't swing around).

Enjoy


Posted By: Silent_Assassin

Re: Ultimate Zelda lock on camera! - 11/24/06 23:54

amazing work

thx for this David
Posted By: Tempelbauer

Re: Ultimate Zelda lock on camera! - 11/24/06 23:56

yeah, looks really cool
i love the zelda games
Posted By: sPlKe

Re: Ultimate Zelda lock on camera! - 11/25/06 02:39

a very usefull contribution. i think if we work aroudn it a little,w e coudl implement it to any type of game. very usefull...

thanx^^
Posted By: DavidLancaster

Re: Ultimate Zelda lock on camera! - 11/25/06 07:32

Thanks for your comments, I appreciate them

If you want the camera to swing behind the player when you right click and no targets are around, make the following changes to line 83 of player.wdl:

Code:

IF (target_enemy == null) {
IF (temp.y > 0) {
IF (mouse_right == 1) {
camera_pan = move_variable(ang(camera_pan),ang(my.pan),20);
} ELSE {
rotate_entity(temp.x,200);
}
} ELSE {
IF (mouse_right == 1) { camera_pan = move_variable(ang(camera_pan),ang(my.pan),20); }
}
} ELSE {


Posted By: Drew

Re: Ultimate Zelda lock on camera! - 11/25/06 07:38

killer contribution!!!
Are the enemies supposed to animate or fight back? they are just standing in place...I would KILL for enemy AI in this...

again THANKS!
Posted By: DavidLancaster

Re: Ultimate Zelda lock on camera! - 11/25/06 08:38

Nope they are meant to be stationary. My concept is, that if you go through the Kingdom Hearts tutorial and understand it, you should be able to use the same programming path/concepts to create AI, it's just a matter of animating and moving an entity...
Posted By: Iglarion

Re: Ultimate Zelda lock on camera! - 11/25/06 15:25

Great work David!!!

Thanks!!!
Posted By: Drittz_Dourden

Re: Ultimate Zelda lock on camera! - 11/25/06 15:44

Wow david! awsome contributation!!!!

Daniel
Posted By: frazzle

Re: Ultimate Zelda lock on camera! - 11/25/06 17:43

Same here David !!
This is an exellent contribution

Cheers

Frazzle
Posted By: Drew

Re: Ultimate Zelda lock on camera! - 11/25/06 21:08

Quote:

Nope they are meant to be stationary. My concept is, that if you go through the Kingdom Hearts tutorial and understand it, you should be able to use the same programming path/concepts to create AI, it's just a matter of animating and moving an entity...




cool thnaks... whew I don't understand code nearly enough for this...I've looked at the code...
If someone is kind enough to share any enemy AI connected to this I would be very grateful!!

for now I'll use this as just movement code...
again, this is a huge contribution to GS, they should hire you to create templates...
Posted By: Germanunkol

Re: Ultimate Zelda lock on camera! - 11/26/06 17:25

I disagree... If the templates where this good, us programmers wouldn't have anything left to do
GREAT work man!!
Posted By: Ludochrist

Re: Ultimate Zelda lock on camera! - 12/06/06 21:11

this is really nice!!
.. one difference i noticed from the zelda cam tho, is when you lock onto something in zelda and move left and right you rotate around that object. i find rotating around an enemy is nice for combat cause you stay within striking distance, but you can still evade any straight on attacks.
Posted By: jigalypuff

Re: Ultimate Zelda lock on camera! - 12/14/06 11:16

this is pretty cool, which part of the code deals with the lock on target? i`d like to use it in a space combat sim, thanks.
Posted By: ello

Re: Ultimate Zelda lock on camera! - 12/14/06 11:51

so you are saying i even can use the model? that is one great contribution. to bad the uv-map is gone;)
Posted By: DavidLancaster

Re: Ultimate Zelda lock on camera! - 12/15/06 04:50

Look for the function:
handle_lockon_camera()

That handles the lock on camera...

Yes I believe so, with the bad uv. If you would like to be sure pm Exile.
Posted By: jigalypuff

Re: Ultimate Zelda lock on camera! - 12/19/06 14:03

is the lock on target code integrated with the camera code then? i am useing the homeworld camera code, is it possible at all to just have the targeting code? thanks
Posted By: DavidLancaster

Re: Ultimate Zelda lock on camera! - 12/20/06 09:32

Not sure what exactly you are looking for, the locking on in regards to the player right clicking and facing a target is covered in the Kingdom Hearts movement tutorial. The code for the camera's unique behavior when you lock onto a target is found in the code in this resource.
Posted By: RobBerg

Re: Ultimate Zelda lock on camera! - 12/08/12 00:59

Sorry for digging up an old thread, but the link is dead and no new link has been provided.

Does anyone know where I can get this code?
Posted By: Iglarion

Re: Ultimate Zelda lock on camera! - 12/08/12 06:29

WOW! This thred is really old, i remember that day when David uploaded this code smile You still can found this great old code in Acknex Unlimited
Posted By: RobBerg

Re: Ultimate Zelda lock on camera! - 12/08/12 10:07

Originally Posted By: Iglarion
WOW! This thred is really old, i remember that day when David uploaded this code smile You still can found this great old code in Acknex Unlimited


Thanks! Thought at first that it might be gone forever. Lucky me it wasn't. smile
Posted By: gamers

Re: Ultimate Zelda lock on camera! - 12/25/12 08:56

link broken ?
© 2024 lite-C Forums