Flexible Lock-On/Targeting System?

Hey everyone,

I’m currently building a 3rd person locomotion system with the intent of making a realistic sword-fighting game. I have 3 basic states of locomotion. Standard or Directional movement, where the player moves in any direction and faces any direction (typical 3rd person), Strafing, where the player moves in any direction but faces the camera direction (think Star wars Jedi Academy), and the last state, Combat or Targeting. I would like the player to be able to “Lock On” to or Orbit any object the camera is looking at. Since it goes from the Strafing mode to Targeting/Combat, the character would already be facing the camera direction, so upon entering the Target/Combat mode I would like the character to Orbit whatever the camera is looking at, whether that be another character or an object or whatever. I already have the Directional and Strafing modes working, but need a little help with the Lock On mode. I was thinking of doing a line trace or something from the camera, and have whatever it hits become the orbit point. It would also need to stay on whatever it hits, so if the object or enemy moves, so does the orbit point.

I’m an animator not a programmer, so I’m sorry if this is a dumb question.

I made Some quick images to help explain this.

Thanks in Advance!

I’ve a video tut on how I went about it…should aim you in the right direction…

Link to tut - Alice in Tokyo Wonderland - Blueprint Only Action Hack n' Slash - Work in Progress - Unreal Engine Forums

Example of what it looks like…
[video]- YouTube
(weird…don’t know why the video is only a link but whatever…just follow it back to Youtube…only 21 secs…)

let me know if you’ve any questions…I tend to be on daily…

Yeah I’ve seen that already. Nice work though. I was hoping for something a bit more flexible, so I could lock onto anything instead of just an enemy. In my concept game, the player can only attack while locked onto something. It is designed for a gamepad, so when the camera and character locks onto a target, the right thumbstick is used to determine sword swing direction, instead of camera movement. Maybe I could have the camera focus on an object, and because the character faces the camera direction, it would naturally orbit the targeted object when strafing left or right?

IF the camera locks the target 1:1 smack in the center of the screen with no give whatsoever, then yes, strafing will automatically become circular. This is because the lateral momentum will change direction every tick relative to where the camera is facing.

Now, the question you need to ask yourself is “is that really how I want my camera to function?” You could probably do something like the DBZ Tenkaichi games do, or SFIV, where the camera is like a TPS over-the-shoulder sort of thing, with the enemy centered and the player not centered. That might work. Otherwise I think you’ll find that the player will become frustrated by the lack of camera control.

This is especially true if your game concept is “the player can lock on to anything”. You’ll need an extremely smart targeting system to make that work, otherwise the player may find himself slicing up a garbage can instead of an oncoming enemy, suddenly blind to what’s around him.

If your game is for controller users, might I recommend devoting the shoulder triggers to camera panning? It’s kind of an old-school approach to camera control but I think it will greatly help ease player frustration with lack of visibility. Especially when locked on, this kind of camera control will help players if they feel that they can’t see both the enemy and themselves clearly (especially pertinent for this kind of game since it’s third person; if you can see your back when what you WANT to see is the direction of the enemy’s swing, you’re gonna get frustrated with the game.)

Remember, when Metal Gear Rising did this exact thing (right stick manual slicing), they pulled the camera in tight to Raiden’s shoulder so that you could clearly see in front of him. By contrast, Blade Symphony was quite fond of showing you more of your own character’s backside than what you actually wanted to see… And, well, it isn’t nearly as fun as MGR.

Yeah I had already thought about these issues don’t worry :smiley: When strafing or targeting, the camera will be offset from the character, with the target in the center. Or the camera could lock the target slightly to the right of the center, with the player character being on the left side of the screen. that way you could clearly see both the player and the target/enemy. The left trigger will control the movement/targeting states. Released is directional movement, partially pressed is strafing movement (camera offsets and targeting reticule appears so the player can target an object, and fully pressed is the target/combat state. Upon entering the combat state, whatever the camera was looking at during the strafing state becomes the target. That way you could change targets quickly by just releasing the left trigger slightly, look at something else, then target again. The concept is more of a dueling game, so there wont be a ton of enemies to constantly keep track of.

here I make tutorial for it

Thanks awesome tutorial Implemented in well seems bit jerky at times but will do for working on more thing for this slash and hack project … Thanks again

Well, I’m afraid I’m a little late, but if anybody’s interested there’s a C++ project that I was working on that implements a Dark Souls style movement and targeting system :slight_smile:
Maybe someone can find a use for it!

This looks like what I want too, but the links in the video description are not working. Looks great though