mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-11-22 23:12:59 +08:00
Fixed collisions bound geometry render transform bug
This commit is contained in:
parent
f98a7c8411
commit
32e75cb2a1
@ -3243,15 +3243,27 @@ namespace CodeWalker.Rendering
|
|||||||
{
|
{
|
||||||
RenderableBoundGeometryInst rbginst = new RenderableBoundGeometryInst();
|
RenderableBoundGeometryInst rbginst = new RenderableBoundGeometryInst();
|
||||||
rbginst.Inst.Renderable = rndbc;
|
rbginst.Inst.Renderable = rndbc;
|
||||||
rbginst.Inst.Orientation = orientation;
|
|
||||||
rbginst.Inst.Scale = scale;
|
|
||||||
if (rndbc.Geometries != null)
|
if (rndbc.Geometries != null)
|
||||||
{
|
{
|
||||||
foreach (var geom in rndbc.Geometries)
|
foreach (var geom in rndbc.Geometries)
|
||||||
{
|
{
|
||||||
if (geom == null) continue;
|
if (geom == null) continue;
|
||||||
rbginst.Geom = geom;
|
rbginst.Geom = geom;
|
||||||
rbginst.Inst.Position = position + orientation.Multiply(geom.CenterGeom * scale);
|
|
||||||
|
var pos = position;
|
||||||
|
var ori = orientation;
|
||||||
|
var sca = scale;
|
||||||
|
if (geom.Bound is BoundGeometry bgeom)
|
||||||
|
{
|
||||||
|
var rmat = bgeom.Transform;
|
||||||
|
sca = scale * rmat.ScaleVector;
|
||||||
|
pos = position + orientation.Multiply(rmat.TranslationVector);
|
||||||
|
rmat.TranslationVector = Vector3.Zero;
|
||||||
|
ori = orientation * Quaternion.RotationMatrix(rmat);
|
||||||
|
}
|
||||||
|
rbginst.Inst.Position = pos + ori.Multiply(geom.CenterGeom * sca);
|
||||||
|
rbginst.Inst.Orientation = ori;
|
||||||
|
rbginst.Inst.Scale = sca;
|
||||||
rbginst.Inst.CamRel = rbginst.Inst.Position - camera.Position;
|
rbginst.Inst.CamRel = rbginst.Inst.Position - camera.Position;
|
||||||
shaders.Enqueue(ref rbginst);
|
shaders.Enqueue(ref rbginst);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user