You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.
Case:
1 Create new default 3D Scene
2 Take Box, create collision body in it by pressing "Add Collision" in editor
3 Place Input processing component in the box, set box as "object controlled by player"
4 Set event handler to "Input Message Event" with script
`
public void InputProcessing_InputMessageEvent(NeoAxis.Component_InputProcessing sender, NeoAxis.UIControl playScreen, NeoAxis.Component_GameMode gameMode, NeoAxis.InputMessage message)
{
var item=sender.Parent.Parent.GetComponent("Box").GetComponent("Collision Body") as Component_RigidBody;
var angleMultiplier = 5;
var keyDown = message as InputMessageKeyDown;
if(keyDown != null)
{
if (keyDown.Key == EKeys.Up)
{
var angles = item.Transform.Value.Rotation.Angles;
var position = item.Transform.Value.Position;
var newRotation = new Angles(0, angles.Pitch + angleMultiplier , 0);
Log.Info("----------");
Log.Info(newRotation);
item.SetRotation(newRotation);
}
if (keyDown.Key == EKeys.Down)
{
var angles = item.Transform.Value.Rotation.Angles;
var position = item.Transform.Value.Position;
var newRotation = new Angles(0, angles.Pitch - angleMultiplier, 0);
Log.Info("----------");
Log.Info(newRotation);
item.SetRotation(newRotation);
}
}
}
`
5 Press Play button in editor
6 Rotate Box over Y axis with Up and Down keyboard keys
7 Note that box doesn't spin futher if angle is lower than -90 or higher than 90 and start twithcing around.
The text was updated successfully, but these errors were encountered:
Another way how to manage rotation. Use quaternion and matrix 3.
var change = Matrix3.FromRotateByY(new Degree(5));
var changeQ = change.ToQuaternion();
var original = item.Transform.Value.Rotation;
item.SetRotation(original * changeQ);
Case:
1 Create new default 3D Scene
2 Take Box, create collision body in it by pressing "Add Collision" in editor
3 Place Input processing component in the box, set box as "object controlled by player"
4 Set event handler to "Input Message Event" with script
`
public void InputProcessing_InputMessageEvent(NeoAxis.Component_InputProcessing sender, NeoAxis.UIControl playScreen, NeoAxis.Component_GameMode gameMode, NeoAxis.InputMessage message)
{
var item=sender.Parent.Parent.GetComponent("Box").GetComponent("Collision Body") as Component_RigidBody;
}
`
5 Press Play button in editor
6 Rotate Box over Y axis with Up and Down keyboard keys
7 Note that box doesn't spin futher if angle is lower than -90 or higher than 90 and start twithcing around.
The text was updated successfully, but these errors were encountered: