Transport menu

Discuss coding questions, pull requests, and implementation details.
Al-Khwarizmi
Posts: 89
Joined: Sun Mar 22, 2015 9:52 am

Re: Transport menu

Post by Al-Khwarizmi » Tue Aug 29, 2017 11:14 am

R.D. wrote:Maybe doesn't seem realistic, but you could also think of it like the horse leveling together with you as you level up and gain speed points.
Or the speed attribute also representing how well you can handle a horse to make it go fast, and not only your own speed when you run.

User avatar
Hazelnut
Posts: 562
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Transport menu

Post by Hazelnut » Tue Aug 29, 2017 11:44 am

Thanks Allofich, that's extremely helpful information. I'll make adjustments accordingly tonight.

Interkarma, I switched from MonoDevelop (used on Sat) to VisualStudio (used Sun & Mon) and I actually think I preferred Mono. Maybe I've not yet seen the true power of VS, and maybe it just takes more time to get used to due to greater complexity. Considering going back to Mono, which would make it easier to switch between my windows 10 gaming PC and Linux laptop. So are there any features in that bag o potato chips that are worth persevering for in your opinion?

Question about adjusting player view height. Where is the view camera attached to the character controller capsule?

User avatar
Interkarma
Posts: 2879
Joined: Sun Mar 22, 2015 1:51 am

Re: Transport menu

Post by Interkarma » Tue Aug 29, 2017 11:59 am

Hazelnut wrote:So are there any features in that bag o potato chips that are worth persevering for in your opinion?
Please use whatever makes you most comfortable. :) My preference is VS, it's a much nicer code editor, but I'm not going to enforce that on you.

Edit: BTW, if problem is mainly Linux compatibility, you should be able to use Visual Studio Code with Unity on Linux and Windows. I haven't done much with Code though, I'm an MSDN subscriber with VS Pro.
https://code.visualstudio.com/
https://code.visualstudio.com/docs/other/unity

Hazelnut wrote: Question about adjusting player view height. Where is the view camera attached to the character controller capsule?
Camera is under the SmoothFollower object beneath PlayerAdvanced. You won't see this in the Project Prefab due to how things are nested (Unity limitation) but you can see it in Hierarchy. To access it from code, GameManger.Instance.MainCamera will return a reference for you to manipulate transform.

User avatar
Hazelnut
Posts: 562
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Transport menu

Post by Hazelnut » Tue Aug 29, 2017 12:12 pm

Interkarma wrote:
Hazelnut wrote: Question about adjusting player view height. Where is the view camera attached to the character controller capsule?
Camera is under the SmoothFollower object beneath PlayerAdvanced. You won't see this in the Project Prefab due to how things are nested (Unity limitation) but you can see it in Hierarchy. To access it from code, GameManger.Instance.MainCamera will return a reference for you to manipulate transform.
I meant is how does it relate to the center of the capsule in 3d space? So I don't need to figure that out myself.

User avatar
Interkarma
Posts: 2879
Joined: Sun Mar 22, 2015 1:51 am

Re: Transport menu

Post by Interkarma » Tue Aug 29, 2017 12:28 pm

Imagine centre of the capsule is about waist height, the current camera local offset of 0.0, 0.8, 0.0 represents player's eye height.

It took a fair bit of tweaking to dial in good dimensions for the player capsule and keep eye height at about the right level. Daggerfall's dungeon geometry can be quite woeful in places, so very easy for player to become find impassible spaces.

One of the problems with raising camera height above capsule is that jumps in low spaces will result in camera clipping through geometry that capsule would have registered a head-hit against. In the case of horse, for example, jumping while passing through stone arch into castle Daggerfall would clip camera through top of arch model (if camera sat above capsule).

This can be a can of worms, it's usually easier just to let collider do the work. Maybe a slightly greater skin width would help rather than lowering height too much or raising camera outside collider. I'm hesitant to change controller too much, and would need to retest against some trouble spots if we do.

User avatar
Jay_H
Posts: 1290
Joined: Tue Aug 25, 2015 1:54 am

Re: Transport menu

Post by Jay_H » Tue Aug 29, 2017 12:29 pm

R.D. wrote:The running formula is in the Daggerfall Chronicles and I also found it in FALL.exe, so it should be correct. ...

As for why you got different results Jay_H, I don't know. My tests were outside, not in an interior, so maybe that's something? I don't think there's different behavior there, though. Maybe try testing over a longer distance. How are you measuring times? I used video recording software when I tested times for estimating the ratio of speed units, and the distance traveled was from walking straight until I hit a wall, so no turning or anything involved.
No problem then, I certainly trust the values you brought out. I'm happy we can close the book on it :) Thanks for explaining how these things came to be.

When you say walking, are you referring to running or walking? I would expect the two behaviors to be different in this regard.
**INDEFINITE HIATUS** Check out the Daggerfall Unity mod page on ModDB.

User avatar
Interkarma
Posts: 2879
Joined: Sun Mar 22, 2015 1:51 am

Re: Transport menu

Post by Interkarma » Tue Aug 29, 2017 12:37 pm

I just had a closer look at this. You have plenty of scope to reduce capsule height currently (it's way too high at the moment). If you check below image, the red line is eye height (this is what player perceives as their face) and blue line is top of player's head.

You can lower capsule height quite a bit here and raise camera height to correct vision point without placing camera above capsule.
capsule.jpg
capsule.jpg (55.48 KiB) Viewed 799 times
And this is why player doesn't fit through arch, top of head is much higher than eye height. Easy fix though. :)
capsule-size.jpg
capsule-size.jpg (46.66 KiB) Viewed 796 times

User avatar
Hazelnut
Posts: 562
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Transport menu

Post by Hazelnut » Tue Aug 29, 2017 12:45 pm

Yes, this is why I was asking. Having now read the unity docs I realised that my code for changing height is pretty dumb and I realised I am making the capsule much bigger than necessary. I need to understand the player representation so I can get it right.

How did you take those screenshots by the way? Would be useful to know without reading unity docs for hours...

Where's the camera offset 0, 0.8, 0 set? In code or in unity editor?

User avatar
Interkarma
Posts: 2879
Joined: Sun Mar 22, 2015 1:51 am

Re: Transport menu

Post by Interkarma » Tue Aug 29, 2017 12:53 pm

You can switch to Scene view while game is running, select PlayerAdvanced in Hierarchy, then use F to focus on that object. Mouse wheel to move Scene view in/out, holding Alt key and left mouse button will rotate view around focused object while moving mouse.

Once I had things in position, just used Snipping Tool To grab part of screen I wanted to show you. Coloured lines were drawn in with Paint.net.
Hazelnut wrote: Where's the camera offset 0, 0.8, 0 set? In code or in unity editor?
Default is a relationship setup in the prefab - but you shouldn't need to change that. You can programmatically increase collider height to where top of player's head would be while sitting on the horse, and raise the camera eye height to slightly below that. If you cache the initial settings when switching to mounted view, you can just set them back when player returns to foot.

User avatar
Hazelnut
Posts: 562
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Transport menu

Post by Hazelnut » Tue Aug 29, 2017 1:01 pm

Thanks, that should help tonight. Asking 20 questions now cos you will be asleep later. :-)

Last question. Why are there 2 prefabs, PlayerAdvanced and PlayerStandalone?

Only former seems to be used, but this confuses me.

Post Reply