Some portrait model problems
See original GitHub issueNow that I have managed to deploy my resources Express server somehow for free, I can open this issue finally. Here’s a demo of the website using the model viewer (best having Friz Quadrata TT font installed): https://peaceful-mcnulty-a8a424.netlify.app/ (just search for the respective hero name/title on the search bar on the lower right)
How do I deal with the issue where some models are not visible at all when setting the camera of the portrait model? Most of the models are fine but some models can’t be seen at certain aspect ratios of the viewport when it’s a bit too wide. Example:
Units/Creeps/SylvanusWindrunner/SylvanusWindrunner_portrait.mdx
(search “alleria”)Units/Orc/HeroFarSeer/HeroFarSeer_portrait.mdx
(search “chen”)Units/NightElf/MountainGiant/MountainGiant_Portrait.mdx
(search “tiny”)- and several others
Also, there’s the problem with the camera of some models where the perspective(?) is wrong. Some models I noticed with this problem:
Units/Demon/HeroChaosBladeMaster/HeroChaosBladeMaster_portrait.mdx
(search “yurnero”)Units/NightElf/DruidoftheClaw/DruidoftheClaw_portrait.mdx
(search “lone druid”, only on non-alternate sequences)
I use the following code for setting the perspective and face direction, how the camera values was used was referenced from d07RiV’s WC3 Data code:
if (model.cameras.length) {
const { farClippingPlane, fieldOfView, nearClippingPlane, position, targetPosition } = model.cameras[0]
const aspectRatio = canvasRef.current.width / canvasRef.current.height
// Custom fieldOfView value from d07RiV's WC3 Data model viewer component
// I don't really understand much but this seems to scale pretty well when used instead of the one in the portrait camera
const scalableFoV = Math.atan(Math.tan(fieldOfView / 2) / aspectRatio) * 2
instance.resetTransformation()
instance.setSequence(portraitSequence === -1 ? 0 : portraitSequence)
scene.camera.perspective(scalableFoV, aspectRatio, nearClippingPlane, farClippingPlane)
scene.camera.moveToAndFace(position, targetPosition, [0, 0, 1])
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:33 (18 by maintainers)
Top GitHub Comments
You shouldn’t need to call
recalculateTransformation()
, your code should intuitively work, so as far as I am concerned this is bug, but if you want a fix for now that will work.localX
is in object space, andworldX
is in world space. If a node is parented, the local values are relative to the parent and the world ones are absolute. If a node isn’t parented, they are the same. E.g. if an instance is moved 50 units on the X axis, and it is parented to another instance that is moved 50 units on the X axis,localLocation[0] == 50
andworldLocation[0] == 100
.There was actually still an issue, because
applyInstanceCamera()
didn’t also use the instance’s own transformation. This should now be fixed, so I think this issue can be closed.