Difference in Dungeon vs World Units?

Discuss modding questions and implementation details.
Post Reply
l3lessed
Posts: 1399
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Difference in Dungeon vs World Units?

Post by l3lessed »

I'm getting an interesting result when casting raycasts over a arc using a basic lerp function.

The arc is created, but if I'm in a dungeon it is much wider arc than when I'm outside. The arc length gets much smaller outside. Is there a difference in dungeon and world units that would effect how tight or wide the vector3 arc is?

Code: Select all

float currentWeaponReach = weaponReach;
//create forward cast that covers distance of weapon.
Vector3 attackcast = GameManager.Instance.PlayerEntityBehaviour.transform.forward * weaponReach;
Quaternion objectRotation;
//run the cast through lookrotation to ensure cast always is rotated to camera forward position.                    
objectRotation = Quaternion.LookRotation(attackcast);
//start lerp calculator that moves cast over a vector3 distance. This creates a half circle arc from right to left.             
attackcast = Vector3.Lerp(new Vector3(-90f, GameManager.Instance.MainCamera.transform.rotation.z, GameManager.Instance.MainCamera.transform.position.z), new Vector3(110f, GameManager.Instance.MainCamera.transform.rotation.z, GameManager.Instance.MainCamera.transform.position.z), percentagetime);
//rotate calculated raycast so it is shooting in front of player no matter where the player looks/moves and how far into the arc cast we are.
attackcast = objectRotation * attackcast;
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

User avatar
BadLuckBurt
Posts: 948
Joined: Sun Nov 05, 2017 8:30 pm

Re: Difference in Dungeon vs World Units?

Post by BadLuckBurt »

There is no difference in units, there are only Unity units where 1 unit == 1 meter.

If it's the same code being fed the same values, the results should be the same so maybe try some hard-coded experiments?
DFU on UESP: https://en.uesp.net/w/index.php?title=T ... fall_Unity
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt

.

Post Reply