chore(scripts): rename script API to GetComponent/TryGetComponent; misc
Clearer accessor naming on ScriptBehavior (Get -> GetComponent, TryGet -> TryGetComponent), WASDMove follows. Teleport marked const (JPH Ref does not propagate constness). Spinner: auto-rotation disabled for the moment, registration switched from the registration macro to an explicit lambda to verify the mechanism.
This commit is contained in:
+10
-1
@@ -24,15 +24,24 @@ namespace {
|
||||
|
||||
void OnUpdate(float dt) override {
|
||||
// 四元数复合绕 Y(避免每帧欧拉↔四元数往返累积失真)
|
||||
|
||||
/*
|
||||
const glm::quat step = glm::angleAxis(
|
||||
glm::radians(m_Speed * dt), glm::vec3(0.0f, 1.0f, 0.0f));
|
||||
Transform().SetRotationQuat(step * Transform().GetRotationQuat());
|
||||
*/
|
||||
}
|
||||
|
||||
private:
|
||||
float m_Speed = 90.0f; // 度/秒
|
||||
};
|
||||
|
||||
ENGINE_REGISTER_SCRIPT(Spinner)
|
||||
static const bool s_Spinner_registered = [] {
|
||||
::Engine::Scripting::ScriptRegistry::Register(
|
||||
"Spinner", []() -> ::Engine::Scope<::Engine::Scripting::ScriptBehavior> {
|
||||
return ::Engine::CreateScope<Spinner>();
|
||||
});
|
||||
return true;
|
||||
}();
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user