Jump to content

Slastraf

Developers
  • Posts

    705
  • Joined

  • Last visited

Posts posted by Slastraf

  1. 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)
    b.PNG.f21632cd1f478a5e99ec580cc62322e0.PNG a.thumb.PNG.f12dca4da3c1bbb4b95f71154a22c7eb.PNG
    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.
    c.thumb.PNG.ca4201c2672405cbf34588bf0f1a2b26.PNG
     

    spiderTex.png

     

    spiderTex.mat spidertorso.mdl.meta spiderTorso.fbx spiderTorso.mdl spider_ver4.mdl

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

    oldSpiderLeg.lua

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

    oldSpiderLeg.lua

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

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

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

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

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

    oldSpiderLeg.lua

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

    Notes.zip 923.01 kB · 0 downloads

    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.

  10. 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.htm

    function 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

     

  11. 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 ?

    2021-04-15 18-40-56.mkv

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

    spider leg.zip

×
×
  • Create New...