Top-Down character look at crosshairs in the vertical

River

New member
Dear Sirs,

I'm a growing fan of the UCC asset. One thing which I enjoy is that the character when walking has an IK that tries to look at the mouse position or the crosshairs.

For the Top-Down set-up the character appears to be turning his head in the left-right axis. However I would like to have the character to also be able to look to the ground(or wherever the cross-hairs are in the vertical direction).

For example when moving the crosshairs close to the characters feet he keeps looking straight-ahead, while for a lot of reasons it would be more natural if he can look and aim down as well - in fact the character can shoot the ground close to his feet (the camera accounts for the vertical look direction), but isn't IK aiming/looking there which looks weird. For example he aims straight ahead with his gun, but the bullet comes out at a downward angle.

Now in the pseudo-2.5 d set-up the character's look IK can look to the ground when aiming there (so the code is there).

How do I enable the character to also be able to look down (e.g. at his feet, when the cross-hairs are there) or up when the crosshairs are on the top of a pile of creates in the Top-Down perspective?

In essence I would like to have the IK be such that it tries to follow the mouse/crosshairs not just in the horizontal, but also in the vertical direction.

Thanks!
 
On the Top Down View Type you can change if the character should look vertically. If you want something more than that this will take modification within the View Type.
 
Hi Justin,

Indeed I had the view type on the Camera Controller set to Vertical Look Direction 'Enabled'. In practice this means for shooting it can also shoot the ground at his feet, while otherwise the character shoots foward.

So as mentioned I am looking for something more: that the head (and the gun when aiming) also adjust to the vertical (e.g. to wherever the cross-hairs reside in the vertical). This to me should be doable with some IK code.

So you mention this will take a modification within the view-type, and I do believe having this as option would enrich the UCC asset (e.g. a possible suggestion for a future update).

Could you provide me a suggestion/solution to make this work for me? - the UCC code is well documented but with so many inheritances and classes it's tricky to make changes. Also as mentioned - yes this can be done since already implemented in other view-types.

Many thanks,

Ps. I'm the same guy who a while back was addressing the issue of the cross-hairs not working in the top-down view (which was solved in the last update).
 
The CharacterIK component uses the ViewTypes LookDirection in order to determine what IK settings to use. So you'll need to start to modify the LookDirection return value.
 
Hi Justin,

Thanks for your patience. I've been digging through the code and have not been able to solve it so far. I found the following code in the TopDown Viewtype:

/// <summary>
/// Returns the direction that the character is looking.
/// As topdown aiming relies on raycasting planes the plane position must match the IK position. Meaning the Movement Type is requesting the plane
/// at the head's position (to match CharacterIK and prevent rotation glitches with the mouse and IK that occur because of angle rays to parallel offset planes).
/// As a result the VerticalLookDirection is limited to above head height. Also, to cover all angles, the Anchor offset should be above head height.

...so is this relevant?

But then it further reads:
// If vertical look direction is enabled then the top down character should be able to aim along the relative y axis. The hit plane should be based
// off of the hit object's relative y position instead of the look position. This allows the character to look up/down while ensuring the direction
// will move through the mouse position.


...so it appears from this that the character should in fact be looking in the up/down direction, which appears to contradict the earlier comment?

To recap: shooting in the vertical it does, but looking in the vertical it doesn't.

Penny for your thoughts, please. Also if you have may specific guidance on where to implement the change would be appreciated. I suppose I could force the Look-IK to have a certain look-target by doing a specific raycast myself when in TOP-Down view type, but I'm worried this may be a 'hack', which may break some of the other scripts.

So at this point I would value your thoughts.

Thanks,
Rob
 
I will need to spend more time going back over those comments, but on first passing it does look like those comments contradict each other. If the vertical look direction is enabled then IK will move up or down based on the hit position.

If you override the look at by doing the IK yourself the only thing that you need to test is whether the shootable weapon also uses the correct rotation when firing.
 
Dear Justin,

It's been a while since we last touched on the above mentioned issue. I hope you had some time to consider the coments in the code? To me it appears the issue is related to the controller code itself. I've had a stab at trying to find a solution, but as mentioned the code is quite layered and I can't see where the solution-fix should reside. Also I'm worried to 'break' the code by making changes, which might not be apparent initially. Ideally you'll appreciate the Controller is used as such and the code should not be tampered with by users. In any case, hoping for your reply, since it's really 'bugging' 'that the character is not looking/aiming where is firing on the vertical.

Cheers and thanks,
 
I have this on my list but have not had the chance to look at it yet. I will let you know when I do.
 
Top