change transform order for relative setPosition to SRT
This commit is contained in:
@@ -1211,7 +1211,9 @@ namespace polyvox
|
||||
|
||||
decomposeMatrix(transform, &translation, &rotation, &scale);
|
||||
if(relative) {
|
||||
translation += math::float3( x, y, z );
|
||||
math::mat3f rotationMatrix(rotation);
|
||||
math::float3 relativeTranslation = rotationMatrix * math::float3( x, y, z );
|
||||
translation += relativeTranslation;
|
||||
} else {
|
||||
translation = math::float3(x,y,z);
|
||||
}
|
||||
@@ -1250,6 +1252,7 @@ namespace polyvox
|
||||
|
||||
transform = composeMatrix(translation, rotation, scale);
|
||||
tm.setTransform(transformInstance, transform);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ class EntityTransformController {
|
||||
updateTranslation = true;
|
||||
}
|
||||
|
||||
// todo - better to use pitch/yaw/roll
|
||||
// TODO - use pitch/yaw/roll
|
||||
bool updateRotation = false;
|
||||
var _rotation = v.Quaternion.identity();
|
||||
|
||||
@@ -92,7 +92,6 @@ class EntityTransformController {
|
||||
relative: true);
|
||||
}
|
||||
if (updateRotation) {
|
||||
var axis = _rotation.axis;
|
||||
await controller.setRotationQuat(_entity, _rotation, relative: true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:async';
|
||||
import 'dart:ffi';
|
||||
import 'dart:io';
|
||||
import 'dart:math';
|
||||
import 'dart:ui' as ui;
|
||||
import 'dart:developer' as dev;
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -1056,6 +1057,7 @@ class FilamentControllerFFI extends FilamentController {
|
||||
if (_viewer == null) {
|
||||
throw Exception("No viewer available, ignoring");
|
||||
}
|
||||
|
||||
set_position(_assetManager!, entity, x, y, z, relative);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user