Jump to content

Leadwerks 4.7 Beta Available

Josh

513 views

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


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

Share this comment


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.

Share this comment


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

Share this comment


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

Share this comment


Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

  • Blog Entries

    • By Josh in Josh's Dev Blog 4
      Here are some screenshots showing more complex interface items scaled at different resolutions. First, here is the interface at 100% scaling:

      And here is the same interface at the same screen resolution, with the DPI scaling turned up to 150%:

      The code to control this is sort of complex, and I don't care. GUI resolution independence is a complicated thing, so the goal should be to create a system that does what it is supposed to do reliably, not to make complicated things simpler at the expense of functionality.
      function widget:Draw(x,y,width,height) local scale = self.gui:GetScale() self.primitives[1].size = iVec2(self.size.x, self.size.y - self.tabsize.y * scale) self.primitives[2].size = iVec2(self.size.x, self.size.y - self.tabsize.y * scale) --Tabs local n local tabpos = 0 for n = 1, #self.items do local tw = self:TabWidth(n) * scale if n * 3 > #self.primitives - 2 then self:AddRect(iVec2(tabpos,0), iVec2(tw, self.tabsize.y * scale), self.bordercolor, false, self.itemcornerradius * scale) self:AddRect(iVec2(tabpos+1,1), iVec2(tw, self.tabsize.y * scale) - iVec2(2 * scale,-1 * scale), self.backgroundcolor, false, self.itemcornerradius * scale) self:AddTextRect(self.items[n].text, iVec2(tabpos,0), iVec2(tw, self.tabsize.y*scale), self.textcolor, TEXT_CENTER + TEXT_MIDDLE) end if self:SelectedItem() == n then self.primitives[2 + (n - 1) * 3 + 1].position = iVec2(tabpos, 0) self.primitives[2 + (n - 1) * 3 + 1].size = iVec2(tw, self.tabsize.y * scale) + iVec2(0,2) self.primitives[2 + (n - 1) * 3 + 2].position = iVec2(tabpos + 1, 1) self.primitives[2 + (n - 1) * 3 + 2].color = self.selectedtabcolor self.primitives[2 + (n - 1) * 3 + 2].size = iVec2(tw, self.tabsize.y * scale) - iVec2(2,-1) self.primitives[2 + (n - 1) * 3 + 3].color = self.hoveredtextcolor self.primitives[2 + (n - 1) * 3 + 1].position = iVec2(tabpos,0) self.primitives[2 + (n - 1) * 3 + 2].position = iVec2(tabpos + 1, 1) self.primitives[2 + (n - 1) * 3 + 3].position = iVec2(tabpos,0) else self.primitives[2 + (n - 1) * 3 + 1].size = iVec2(tw, self.tabsize.y * scale) self.primitives[2 + (n - 1) * 3 + 2].color = self.tabcolor self.primitives[2 + (n - 1) * 3 + 2].size = iVec2(tw, self.tabsize.y * scale) - iVec2(2,2) if n == self.hovereditem then self.primitives[2 + (n - 1) * 3 + 3].color = self.hoveredtextcolor else self.primitives[2 + (n - 1) * 3 + 3].color = self.textcolor end self.primitives[2 + (n - 1) * 3 + 1].position = iVec2(tabpos,2) self.primitives[2 + (n - 1) * 3 + 2].position = iVec2(tabpos + 1, 3) self.primitives[2 + (n - 1) * 3 + 3].position = iVec2(tabpos,2) end self.primitives[2 + (n - 1) * 3 + 3].text = self.items[n].text tabpos = tabpos + tw - 2 end end ย 
    • By ๐Ÿ’ŽYue๐Ÿ’Ž in Dev Log 5
      The prototype of a four-wheeled vehicle is completed, where the third person player can get on and off the vehicle by pressing the E key. ย To move the vehicle either forward or backward, is done with the keys W, and the key S, to brake with the space key. ย And the principle is the same as when driving the character, a third person camera goes behind the car orbiting 360 degrees.

      I don't think the vehicle is that bad, but I'm absolutely sure it can be improved. ย The idea is that this explorer works with batteries, which eventually run out during the night when there is no sunlight.
      Translated with www.DeepL.com/Translator
      ย 
      Mechanics of the game.
      I'm going to focus on the mechanics of the game, establish starting point (Landing area), after the orbiter accident on Mars where all your companions died, now, to survive, you will have to repair your suit, oxygen runs out, good luck. ย This involves replacing the oxygen condenser that is failing and the suit is stuck.

      On the ground and performance.
      The rocks, the terrain and the vehicle kill the SPF, but there is a solution, and everything is related to the chassis of the vehicle. That is to say that if I put a simple collision bucket for the vehicle, the yield recovers, something that does not happen if I put a collider of precise calculation for the car. This has the advantage of better performance but is not very accurate, especially when the car crashes with an object in front, because the horn of the car has no collision. And the solution to this, is to put a sliding joint, as was done with the area in which the player climbs the car and descends from it.


      ย 
      On the rocks, I am trying to make them with the slightest polygons and the most distant from each other.ย 
      Obviously on Mars I can not create canyons, high mountains, is because the terrain does not produce shadows on itself, that's why the terrain tries to be as flat as possible, simulating a desert with dunes.ย 

      That's all for now.
      ย 
    • By ๐Ÿ’ŽYue๐Ÿ’Ž in Dev Log 9
      The prototype is finished, and the mechanics of the game can be given way. ย It has established a desert terrain in the form of dunes, this implies that there are no cannons or anything similar, because Leadwerks does not allow a terrain to cast shadows on that same terrain and this looks visually rare.
      So the terrain is like low-slope dunes. On the other hand, I think the texture of the terrain is already the definitive one, with the possibility of changes and suggestions on the part of those involved in this project.
      On the other hand we have taken the model of a habitat of the nasa, which certainly looks very nice.ย 
      The next steps, are to establish the starting point of the player, this must start near the capsule return to Mars somewhere on the map of 2024 x 2.
      And think about the first thing you should do, repair your suit? Seek a shelter? things like that. ย 


ร—
ร—
  • Create New...