Jump to content
  • entries
    944
  • comments
    5,899
  • views
    929,666

Leadwerks 4.7 Beta Available


Josh

3,002 views

 Share

A new build is available on the beta branch on Steam.

  • Updated to Visual Studio 2019.
  • Updated to latest version of OpenVR and Steamworks SDK.
  • Fixed object tracking with seated VR mode. Note that the way seated VR works now is a little different, you need to use the VR orientation instead of just positioning the camera (see below).
  • Added VR:SetRotation() so you can rotate the world around in VR.
  • The VRPlayer script has rotation added to the left controller. Press the touchpad to turn left and right.
  • Any arbitrary rotation will work, including roll and pitch.

Here are the offset commands:

static void VR::SetOffset(const Vec3& position);
static void VR::SetOffset(const float x, const float y, const float z);
static void VR::SetOffset(const float x, const float y, const float z, const float pitch, const float yaw, const float roll);
static void VR::SetOffset(const Vec3& position, const Vec3& rotation);
static void VR::SetOffset(const Vec3& position, const Quat& rotation);
static Vec3 VR::GetOffset();
static Vec3 VR::GetRotation();
static Quat VR::GetQuaternion();

 

  • Like 2
 Share

8 Comments


Recommended Comments

Quote

Any arbitrary rotation will work, including roll and pitch

Does this mean that we won't have to worry about euler/quaternion any more?  SetRotation and GetRotation will just work, without having to deal with conversions?

  • Like 1
Link to comment
15 hours ago, gamecreator said:

Does this mean that we won't have to worry about euler/quaternion any more?  SetRotation and GetRotation will just work, without having to deal with conversions?

Can you be more specific? Eulers and quaternions will both work. Eulers are easy to visualize, and are fine for rotation on one axis (as most people will be using it) but quaternions are needed if you are making a space sim or something like that.

Link to comment

There is no global euler rotation stored. If you are setting a euler rotation in global space (and the parent is not NULL) then there is a conversion process whereby the euler is transformed into a quaternion. When you call GetRotation() with the global flag set, the rotation is extracted from the global 4x4 matrix and converted to a euler and returned.

This is the source code of the GetRotation() command:

	Vec3 Entity::GetRotation(const bool global)
	{
		if (global == true and parent.lock() != nullptr)
		{
			return Vec3(mat.GetRotation());//Mat4::GetRotation() returns a quaternion, this is then converted to a Euler
		}
		else
		{
			return rotation; //returns the local euler rotation, whatever was last set
		}
	}

Only local position, rotation, and scale values are stored, because if the object has a parent, moving the parent would invalidate all those global values and they would require constant recalculation.

Now I have set it so when rotation is set in local space, that rotation is calculated to the local quaternion, but the original rotation value you input is preserved if you call GetRotation() with the global flag set to false, or if there is no parent. I also made it so that Turn() will increment the angle on one axis if the other two axes in the turn value are zero.

But if that local euler gets recalculated for any reason or if a rotation is extracted from the matrix, it is possible for two different values to define the same rotation, like (270,0,0) and (-90,0,0).

  • Like 1
Link to comment

Testing the beta, in 3d view, icons representing entities such as the camera, the lights do not turn in the direction of the camera. 

  • Thanks 1
Link to comment

The particle system has something strange about it, the particles do not rotate in the direction of the chamber. 

Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...