-
Posts
705 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Posts posted by Slastraf
-
-
12 hours ago, Marcousik said:
Maybe it is not so simple as expected if the bones are controlled by a skeleton?
Should work regardless. How would you put a sword on a hand for a rpg for example ?
Edit it is fixed now -
I forgot I did something in my script to make this behaviour.
-
I have issues importing a very simple model.
If I apply baked textures from blender spots on the model will be black. Also UV's will not be the same as in blender.
Also when applying a material with animation shader the model will disappear. This is the blender view (sorry for gore-ish)
Above the leadwerks view. Major black spot on top and also completely misaligned UV's.
As I said, with animation shaders it will just disappear. I also needed to make three copies of the fbx until it was imported without random holes in the mesh.
spiderTex.mat spidertorso.mdl.meta spiderTorso.fbx spiderTorso.mdl spider_ver4.mdl
-
I have played around some more and managed to align the boxes to the other spider leg again.
But as soon as I enable another leg and it comes into view , not before, the whole thing breaks again.
Here another script where you can enable/disable. Look at the video, its very weird. -
At this time I have come to the conclusion that every type of entity has different rotation "offset" that is all over the place.
I have had the boxes align to the leg model without bones, align it to the leg with bones but now I broke everything and cant revert it.
I need to find some universal rule for inversing the rotations. They are as I found out by default not inverse. Thats why it's called "Inverse Kinematics" ha.
Here is the script that creates boxes as knee etc. Still need to experiment with it to make it work on everything -
I have replicated the issue with three boxes. They are now doing the same weird rotation as the leg with bone (but are just boxes with relation)
- 1
-
1 minute ago, Josh said:
Is it possible to create and display a box at the calculated position of the knee and foot?
Hard to make because only distance is taken into account.
To place boxes at the starting position and then relate them to copy over the rotation would be possible.
I will do this right now and post the script. -
1 minute ago, Josh said:
There's a lot of places this could go wrong.
- There are extra bones in the animated model hierarchy
- One of the limbs up the hierarchy is scaled to 100,100,100
- One of the limbs up the hierarchy has a 90 degree pitch
Any of those things could be acting in an unpredictable manner if the rotation calculation code isn't 100% perfect. If it is possible I would be looking to simply that model leg and try to get it as close as possible to the working leg.
The rotation is set like this
- during runtime the entity of the script makes a new pivot on itself and set itself as child of the new pivot
- this new pivot points at the target point so it eliminates two axis of rotation
- to set the x rotation of the leg the two bones are determined and a triangle with base from leg origin to target is made.
- then from the length of the origin of the leg to the knee, and from the length knee to the target, the other two sides are determined.
- with that there is enough information to calculate two angles, one of the upper leg and lower child leg and set. (something with arccos)
For the latter, I am confident they are calculated correctly because one of the leg works when inverted.
For the leg with bone, I already tried to store offset rotation at start and add it to the calculated rotation with weird outcome.
When I modeled the leg I tried to keep it as clean as possible. Everything that came out was not avoidable. -
14 minutes ago, Josh said:
I ran the project and it look like it is running a terrain generation program?
If I run in release I mode I get this error:
index field 'targetPoint' (a nil value)
In spiderleg.lua, line 50, when running the "start" map.
You need to reset the targetPoint to sphere_Far and Sphere 1 as in the screenshots.
It was in the map data but probably lost when you opened it somehow. -
-
Try it in the fps template, it has the fps player in there
-
Thanks for trying. Is there any fix ?
-
6 minutes ago, Josh said:
If you can upload the files to run the example I am happy to examine it.
Yes I hope it was everything.
-
1 minute ago, Josh said:
You don't actually need to use SetQuaternion in this situation. You could just call SetRotation. You are constructing a quaternion from a Euler with rotation only on one axis, so you aren't going to lose any precision by calling SetRotation with the Euler.
Yes I have used both now and they have the same result. I thought SetQuaternion was going to fix it but it didn't.
-
I have converted the script and tried to make a lot of adjustments, but so far have not been able to accurately replicate rotation of an already working model without bones.
The script is uploaded here, but I don't know why the model with bone (not the green +yellow one) is still acting strangely.
It seems to not track the target blue sphere accurately.
I have uploaded the bone model before.
Really would like to proceed with normal development speed but I sit on this sole issue for two days now and really don't know any fix.
//edit In the video the model with bone has 3 "parts" of the leg but the rock box should be on the same position as the blue sphere -
2 hours ago, Josh said:
I am curious, who's account is this item uploaded on?:
https://steamcommunity.com/sharedfiles/filedetails/?id=388493460
I have seen this feature reused in so many games. It would be nice to have this in the downloads area.
Last time I tried to use that it crashed on me. But that was years ago and maybe I had the actual notes.txt or whatever it is importing in some other folder and maybe it crashed because of that.
-
2 minutes ago, Josh said:
The engine already does this. I believe you can just call Quat(Vec3(90,0,0))
Oh, I thought you needed a W also but it does work like that. This needs to be in the documentation
-
Here a minimally tested lua funciton to convert from Euler to Quat in LE
source http://www.euclideanspace.com/maths/geometry/rotations/conversions/eulerToQuaternion/index.htmfunction eulerToQuat(x,y,z) --Assuming the angles are in radians. local c1 = Math:Cos(x*0.5); local s1 = Math:Sin(x*0.5); local c2 = Math:Cos(y*0.5); local s2 = Math:Sin(y*0.5); local c3 = Math:Cos(z*0.5); local s3 = Math:Sin(z*0.5); local c1c2 = c1*c2; local s1s2 = s1*s2; return Quat(c1c2*s3 + s1s2*c3, s1*c2*c3 + c1*s2*s3, c1*s2*c3 - s1*c2*s3, c1c2*c3 - s1s2*s3) --[[ w =c1c2*c3 - s1s2*s3; x =c1c2*s3 + s1s2*c3; y =s1*c2*c3 + c1*s2*s3; z =c1*s2*c3 - s1*c2*s3; --]] end
-
Yeah that pointed me in the right direction, but still not the desired outcome. i will not get a $70 textbook on that so I need to rely on utube now.
-
Here is the quat test file. I am pretty confident it would work normally on any other thing than a bone. But have not tried it there yet.
-
As far as I understand an quatof xyz = 100 is the "lookAt" vektor of the model and "W" the rotation on that axis (global euler x in that case). if it goes from 0-180 it should turn on that x axis ( It is doing just that, but it should never scale itself up. It is a bug.)
The point is, neither setQuat or setRot work as they both have inpredictable outcomes.
I am 99% sure that the scaling up issue is a bug so that makes quats unusable in LE currently. Can you confirm that ? -
I have uploaded a version in the downloads tab.
- 1
-
Here is a private video that shows different ways of rotating in Leadwerks and how they all do not work on bones from models.
Moreover, I tried using quaternions to rotate the spider leg around the x axis, which worked but scaled the model up in the process for no reason.
The red, green and blue are rotated on the x , y and z but none of them actually rotate around the x axis. If you set rotation to global, the outcom eis worse.I am running out of ideas. i have uploaded the spider leg mdl and fbx so you can try yourself.
-
-
Description
Inverse Kinematics in Leadwerks.
- 1
-
Description
Procedural animation spider
in Showcase
Posted
This is a spider which walks in a responsive way to the ground.
Inverse Kinematics + regular animation