-
Posts
23,352 -
Joined
-
Last visited
Community Answers
-
Josh's post in GetAnimationFinish()? was marked as the answer
No, but there is an EndAnimation script and actor function that will get called automatically:
https://www.leadwerks.com/learn?page=Tutorials_Lua-Scripting_Introduction-to-Lua
-
Josh's post in 4.6 Joints tilt when pushed by character controller was marked as the answer
The player will exert a force on objects it is standing on if the object has the "Scene" collision type. This is sort of a hack to make it so he exerts force on the see-saw puzzle. Try changing the platform collision type to "Prop".
-
Josh's post in Transport a box? was marked as the answer
If you want the box to still collide with the level and be droppable, use a kinemetic joint like I did for the FPS script. However, you might not want the player accidentally bumping into walls and dropping the box, in which case maybe you just need to make it smaller and parent it to the hands, with an animation for the upper body holding a box.
Good gameplay and realism are sometimes different things, so I would not get stuck too hard on making the physics on that "realistic".
Maybe he could simple carry the box over his head?
-
Josh's post in Vector to Rotation was marked as the answer
The difficulty here is that a vector does not describe a 3D rotation. You need another term for roll, and your vector you used above demonstrates the exact problem, since it points straight up.
Mat4 mat; mat.MakeDir(x,y,z) Quat rotation = mat.GetQuaternion() Note this will still have problems when pointing straight up.
-
Josh's post in Entity::SetObject() was marked as the answer
A script must be assigned for an entity to contain script properties. Quick test:
#include "Leadwerks.h" using namespace Leadwerks; int main(int argc, const char *argv[]) { Leadwerks::Window* window = Leadwerks::Window::Create(); Context* context = Context::Create(window); World* world = World::Create(); Camera* camera = Camera::Create(); camera->SetRotation(35, 0, 0); camera->Move(0, 0, -6); Light* light = DirectionalLight::Create(); light->SetRotation(35, 35, 0); //Create a model Model* model1 = Model::Box(); model1->SetPosition(-1, 0, 0); model1->SetColor(0.0, 0.0, 1.0); //Create a copy Model* model2 = (Model*)model1->Copy(); model2->SetPosition(1, 0, 0); model2->SetColor(0.0, 1.0, 0.0); //Lets modify some vertices to show the copy is unique Surface* surface = model2->GetSurface(0); surface->SetVertexPosition(0, -0.5, -2, -0.5); surface->UpdateAABB(); model2->UpdateAABB(Entity::LocalAABB | Entity::GlobalAABB); model1->SetScript("Scripts/null.lua"); model1->SetObject("TEST", surface); auto a = model1->GetObject("TEST"); Debug::Assert(a == surface); while (true) { if (window->Closed() || window->KeyDown(Key::Escape)) return false; Leadwerks::Time::Update(); world->Update(); world->Render(); context->Sync(); } }
-
Josh's post in Kinematic::Break() was marked as the answer
There are commands to set the max friction the joint can use. Set these to zero to disable the joint.
-
Josh's post in Transform::Point was marked as the answer
Change this:
Vec3 vg = Transform::Point(vp, model, NULL); To this:
Vec3 vg = Transform::Point(vp, model->GetChild(0), NULL); Vertex positions are relative to the model they are part of.
-
Josh's post in Error with graphics hardware was marked as the answer
Your graphics card is 11 years old, and is not supported.
-
Josh's post in Camera Pitch Rotation problem was marked as the answer
The problem is that the Euler rotation returned by GetRotation in your UpdateCamera function is ambiguous. Try SetMatrix to replace SetRotation and SetPosition.
--Adjust the camera orientation relative to entity function Script:UpdateCamera() self.camera:SetMatrix(self.entity:GetMatrix(true),true) self.camera:Move(0,1,0) end
-
Josh's post in A Question about navmesh was marked as the answer
To check if a point is inside the navmesh you could try to navigate to that point from another point you know is inside the navmesh.
This command will return true if a path is successfully plotted:
https://www.leadwerks.com/learn?page=API-Reference_Object_Entity_GoToPoint
-
Josh's post in FBX problem was marked as the answer
We updated the FBX converter in version 4.5. In version 4.4 and before a different FBX converter was used. The old FBX converter is still available here:
C:\Program Files (x86)\Steam\Steamapps\common\Leadwerks\Tools\fbx2mdl_old.exe
If you rename that to "fbx2mdl.exe" then the editor will use it instead.
I don't know any reason the new FBX converter would have a problem, but that is the only thing I can think of.
-
Josh's post in How can I prevent the tyres from bouncing? was marked as the answer
Spring has new parameters:
void Joint::SetSpring(const float spring, const float relaxation = 1.0f, const float damper = 0.1f) -
Josh's post in Tips to improve my vehicle with joints? was marked as the answer
Spring has new paramters:
void Joint::SetSpring(const float spring, const float relaxation = 1.0f, const float damper = 0.1f)
-
Josh's post in PickInfo.triangle was marked as the answer
In the current build a sphere test (pick with radius) will not detect a single triangle.
In the next version I am replacing the mesh picking code and a triangle will be detected when the radius is non-zero.
-
Josh's post in Oculus Touch controller thumbsticks was marked as the answer
https://www.leadwerks.com/learn?page=API-Reference_Object_VR_GetControllerAxis
Syntax
Vec2 GetControllerAxis(number index, number button) Parameters
index: The index of the controller, either Left or Right. button: The button to retrieve the axis value for. This can be TouchpadAxis, TriggerAxis, or GripAxis. -
Josh's post in Full-screen while running was marked as the answer
Nope, you create a new context on your new window.
-
Josh's post in Loading from the encrypted data file was marked as the answer
ReadFile will work on your own zip files. If the encrypted zip files could be read that would kind of defeat the purpose of encryption. ?
-
Josh's post in [Solved ]Tire steering tips ? was marked as the answer
It will work. The wheels with steering need an additional pivot between the suspension pivot and the wheel. This pivot uses a hinge joint with an axis of (0,1,0). The motor for this joint should be enabled at all times, and you just set the target angle to control the steering.
-
Josh's post in Moveing a Sliders parent was marked as the answer
If you use the positioning commands like Move, SetPosition, etc. you are breaking the physics simulation that frame. Instead, you can create a a kinematic joint and use that to precisely control an object's position:
https://www.leadwerks.com/learn?page=API-Reference_Object_Joint_Kinematic
https://www.leadwerks.com/learn?page=API-Reference_Object_Joint_SetTargetPosition
-
Josh's post in Shock absorbers have a strange behavior was marked as the answer
You can see that since you are using a motor instead of a spring, the correction force is constant. A spring would increase the force as it gets further from the equilibrium point. I will be looking at the spring damper soon to see if we can minimize bouncing / harmonics.
-
Josh's post in Modelling scale for Leadwerks / Maya was marked as the answer
1 unit space equals one meter. The FBX importer in the beta branch will read the file scale and import it at the correct size.
-
Josh's post in Any examples of a car physics system for joints on Lua? was marked as the answer
https://www.leadwerks.com/learn?page=API-Reference_Object_Joint
use slider joints with springs for the shocks. Use hinge joints for the wheels. The joint motor commands can be used to control the car.
-
Josh's post in Windows access rights and leadwerks game was marked as the answer
By default you can only access files in the user appdata or documents paths. This is where any files should be written to. This is not a Leadwerks thing, it is just how Windows works.