Jump to content

Leadwerks 4.7 Beta Available



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


Recommended Comments


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
			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

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

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.

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 💎Yue💎 in The shock absorbers 2
      Coming to the end of my prototype of a 3d game, and with background music by Hanz Zimmer ( Time ). I saw my progress in many aspects, always something to learn, always something to improve, I didn't intend to make a game, that has never been the goal. 
      Rather, the effort and dedication immeasurably, was to improve on something learned. And here I was with the powerful leadwerks engine, where his greatest power lay in making everything very easy.  
      About the project
      The prototype is very simple, a third person character goes through a stage, an orbital camera that follows him with many interesting things when scripting.  A character who runs, walks, ducks, jumps, and suffers damage when he falls from different heights. 
      The interesting thing about all this is that just like when you're little and learn to write, repetition is key to learning to program, understand concepts and improve.  So as I've always said, you learn to program by programming, although I sincerely think that lua script is not programming, but the experts say it is, so I go into that elitism of those of us who think we are programmers. 
      The final part of the project consists of creating a death animation, this will be activated when the player falls from a high part and separates the legs (that is very cruel). 
      But that feeling of improvement is the same that I feel when in the mornings when I have a coffee I solve a riddle of the newspaper, but I don't know when I'm going to stop, it turns out and it happens that technology advances very fast and this continues and continues without stopping. Starting with LE 5, and the only thing that can happen is that I die or that my old computer doesn't work anymore. 
      Translated with www.DeepL.com/Translator

    • By 💎Yue💎 in The shock absorbers 1
      It's interesting that when you become an expert on something, you're not sparing any effort to see how something works, but rather you're focusing on creating something. And so everything becomes easier.
      At this point of learning there is a glimpse of a low idea of creating a game, but the secret of all this is to keep it simple and to be very clear that a game is a game, and not an exact simulation of the real world. For example anyone who has a low idea of the red planet, will understand no matter the colors of the scene that is a terrain of Mars, even if it is not very real what is transmitted, a game, that's just it.
      At this point I already have an astronaut character who runs from one place to another on a very large 4096 x 4046 terrain that would surely take a long walk. My previous prototype projects involve a vehicle, but I didn't get the best implementation prospect in that time and I always found performance problems in my machine, something that isn't happening with the character controller for a third person player. 
      As always, I think I'm a scavenger looking for game resources, that's where this community exposes links to websites with interesting hd textures, and one or another model searched on the net, but what I've greatly improved is learning to write code, I have a better workflow, writing Lua code focused on the paradigm of object programming.

      Something interesting is the system of putting rocks, all very nice from the point of implementing them. And it works very well with the character controller if you put collision in cube form.
      I've been thinking about implementing a car system, I think it would be necessary in such a large terrain, but I think it's not the time, my previous experience, involves deterioration in performance and something I think is the physics of the car with respect to the terrain and rocks that in the previous project involve deterioration in the fps. Although if you implement a car would have an option would be to remove the rocks, but I prefer not to have a car and if you have rocks. 
    • By Josh in Josh's Dev Blog 3
      What's new
      EAX audio effects for supported hardware. Source class renamed to "Speaker". Plane joint for 2D physics, so now you can make Angry Birds with Vulkan graphics. Fixed DPI issues with fullscreen mode. Added impact noise to barrels, fixed Lua collision function not being called. Script functions now start with "Entity:" instead of "Script:", i.e. Entity:Update() instead of Script:Update(). Additionally, four examples can be run showing various functionality. Double-click on the .bat files to launch a different demo:
      First-person shooter game. 2D physics demonstration. Advanced 2D drawing with text, rotation, and scaling. Multi-camera setup.
  • Create New...