Fix position and rotation of track anchors not set.
This commit is contained in:
@@ -133,7 +133,7 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Vector3 GetFramePoint(ContainerState state, float track) {
|
Vector3 GetFramePoint(ContainerState state, float track) {
|
||||||
return GetFrame(state, track, th => ((TrackHandler)th.Handler).GetCurrentWorldPoint());
|
return GetFrame(state, track, th => th.Handler.Position);
|
||||||
}
|
}
|
||||||
|
|
||||||
Quaternion GetFrameRotation(ContainerState state, float track) {
|
Quaternion GetFrameRotation(ContainerState state, float track) {
|
||||||
|
@@ -35,7 +35,7 @@ namespace Cryville.Crtr {
|
|||||||
base.StartGraphicalUpdate(s);
|
base.StartGraphicalUpdate(s);
|
||||||
if (RootTransform) {
|
if (RootTransform) {
|
||||||
TransformAwake(s);
|
TransformAwake(s);
|
||||||
var p = GetCurrentWorldPoint();
|
var p = Position;
|
||||||
foreach (var i in sgos) {
|
foreach (var i in sgos) {
|
||||||
i.Reset();
|
i.Reset();
|
||||||
i.AppendPoint(p, s.QuatDir);
|
i.AppendPoint(p, s.QuatDir);
|
||||||
@@ -51,6 +51,8 @@ namespace Cryville.Crtr {
|
|||||||
bpos = cpt;
|
bpos = cpt;
|
||||||
brot = Quaternion.Euler(s.Direction);
|
brot = Quaternion.Euler(s.Direction);
|
||||||
}
|
}
|
||||||
|
Position = pwp + cpt + spos;
|
||||||
|
Rotation = Quaternion.Euler(s.Direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 cpt; // Current point
|
Vector3 cpt; // Current point
|
||||||
@@ -81,11 +83,12 @@ namespace Cryville.Crtr {
|
|||||||
ppt += dpt;
|
ppt += dpt;
|
||||||
|
|
||||||
ptime = s.Time;
|
ptime = s.Time;
|
||||||
|
Position = pwp + cpt + spos;
|
||||||
|
Rotation = Quaternion.Euler(s.Direction);
|
||||||
|
|
||||||
if (!RootTransform || s.CloneType == 3) return;
|
if (!RootTransform || s.CloneType == 3) return;
|
||||||
var p = GetCurrentWorldPoint();
|
|
||||||
foreach (var i in sgos)
|
foreach (var i in sgos)
|
||||||
i.AppendPoint(p, s.QuatDir);
|
i.AppendPoint(Position, s.QuatDir);
|
||||||
}
|
}
|
||||||
else UpdatePosition(s);
|
else UpdatePosition(s);
|
||||||
}
|
}
|
||||||
@@ -96,19 +99,20 @@ namespace Cryville.Crtr {
|
|||||||
pwp = Vector3.zero;
|
pwp = Vector3.zero;
|
||||||
ptime = s.Time;
|
ptime = s.Time;
|
||||||
length = 0;
|
length = 0;
|
||||||
// Logger.LogFormat("main", 0, "Debug", "SV: {0}", cs.GetRawValue<Vec1m>("svm").Value);
|
Position = pwp + cpt + spos;
|
||||||
|
Rotation = Quaternion.Euler(s.Direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Fix anchor rotation
|
// TODO Fix anchor rotation
|
||||||
public override void Anchor() {
|
public override void Anchor() {
|
||||||
base.Anchor();
|
base.Anchor();
|
||||||
spos = bpos - GetCurrentWorldPoint();
|
spos = bpos - Position;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void EndGraphicalUpdate(ContainerState s) {
|
protected override void EndGraphicalUpdate(ContainerState s) {
|
||||||
base.EndGraphicalUpdate(s);
|
base.EndGraphicalUpdate(s);
|
||||||
EndUpdatePosition(s);
|
EndUpdatePosition(s);
|
||||||
var p = GetCurrentWorldPoint();
|
var p = pwp + cpt + spos;
|
||||||
foreach (var i in sgos) {
|
foreach (var i in sgos) {
|
||||||
i.AppendPoint(p, s.QuatDir);
|
i.AppendPoint(p, s.QuatDir);
|
||||||
i.Seal();
|
i.Seal();
|
||||||
@@ -131,10 +135,8 @@ namespace Cryville.Crtr {
|
|||||||
var wp = pwp + dwp; // World point
|
var wp = pwp + dwp; // World point
|
||||||
pwp = wp;
|
pwp = wp;
|
||||||
ppt += dpt;
|
ppt += dpt;
|
||||||
}
|
Position = pwp + cpt + spos;
|
||||||
|
Rotation = Quaternion.Euler(s.Direction);
|
||||||
public Vector3 GetCurrentWorldPoint() {
|
|
||||||
return pwp + cpt + spos;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user