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