We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Help please!! moving cross object by pointer moving

Home Forums Puzzles Help please!! moving cross object by pointer moving

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #59224
    liranhersh
    Participant

    hello everyone I am discouraged dont find answer :unsure:

    I create in blender 3d character walking animation in a loop. the “headbone” of this amature (there is no keyframe to this bone) I connect to Cross with bone constraint – track to.
    in blender when the walk animation working, I can take the cross and move around, the head follow the rotation after the cross.

    now, in Verge3D, I want to move the head to side by move the cross after the mouse pointer around, how can I do it?

    here I upload a video with the problem, tnx!
    https://youtu.be/buyQo_9P5aQ

    Attachments:
    You must be logged in to view attached files.
    #59234
    kdv
    Participant

    You already have the solution https://www.soft8soft.com/topic/camera-problem-with-puzzles/ in your own topic.

    Just uncheck “inverted” and increase the factor from 3 to 10+. This factor defines the distance between the scene camera and your object.

    https://v3d.net/av8

    Puzzles and JS. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of meaning at all.

    #59243
    liranhersh
    Participant

    ok, the cube follow the cross mouse this is good. but the headbone didn’t follow the cube, even the “track to” constraint in blender.

    maybe something that define the connection between the cube to the headbone of the character with “track to” constrain.

    I used “chatgpt” it provied me a javascript code that define the conection.
    this is the code but it still dont working:

    // Get a reference to the object with the constraint applied
    var object = app.getObjectByName(“Armature_mixamorig_Head”);

    // Set the target object or point for the constraint
    var target = app.getObjectByName(“Cube”);

    // Apply the constraint to the object
    object.trackTo(target);

    can you help please?

    #59244
    kdv
    Participant

    app.getObjectByName(‘Cube’)

    this won’t work. app has no getObjectByName function. this will return an error. app.scene.getObjectByName('Cube') will work. and objects don’t have trackTo() function. The entire code above is a nonsence.

    I’m not sure that Verge3D supports bone constraints. Looks like they are not exported. But you can break the system and create a standard constraint.

    https://v3d.net/dqv

    Puzzles and JS. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of meaning at all.

    #59251
    liranhersh
    Participant

    I did the same code like in the picture I add.
    no working. but when I delete the exec script, the cube following well after the mousemovement/

    what is the problem with the java script?

    app.controls.enableRotate = false; //disable camera rotation
    const target = app.scene.getObjectByName(‘Cube’);
    const constraint = new v3d.TrackToConstraint(target);
    constraint.trackAxis = ‘Y’;
    constraint.upAxis = ‘Z’;
    constraint.fixCameraLightRotation = true;
    const bone = app.scene.getObjectByName(‘Armature_mixamorig_Head’);
    bone.constraints.push(constraint);

    Attachments:
    You must be logged in to view attached files.
    #59253
    kdv
    Participant

    press F12 and see errors in the browser console. your code is working (one typo: constraint.upAxis = ‘-Z‘;). problems can be with the target or bone objects. see the log which of them is undefined.

    p.s. share your app files or blend file.

    Puzzles and JS. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of meaning at all.

    #59263
    liranhersh
    Participant

    TNX :)
    WHAT IT MEAN THE PROBLEMS, I DONT UNDERSTAND, WHAT I NEED TO CHANGE IN THE SCRIPT CODE?

    Attachments:
    You must be logged in to view attached files.
    #59265
    kdv
    Participant

    remove the first line in the script. Looks like you use camera with no controls or it’s not the orbit camera and there is no need to disable the camera rotation. red error warnings are in English and they can be read and analyzed )))

    Puzzles and JS. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of meaning at all.

    #59266
    liranhersh
    Participant

    Thank you very much kdv77kdv,
    I tried deleting the first row and it still doesn’t work, very frustrating. :-(

    I tried to understand the comments in red and could not solve the problem. I am uploading here a link to the file in Blender, could you please help me to do it correctly in verge3d?

    thank you very much for everything

    #59267
    kdv
    Participant

    see no problems with your sheep. it works as expected with no additional actions from my side…

    const target = app.scene.getObjectByName('cross');
    const constraint = new v3d.TrackToConstraint(target);
    constraint.trackAxis = 'Y';
    constraint.upAxis = '-Z';
    constraint.fixCameraLightRotation = true;
    const bone = app.scene.getObjectByName('Armature_mixamorig_Head');
    bone.constraints.push(constraint);

    https://v3d.net/dr5

    Puzzles and JS. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of meaning at all.

    #59270
    liranhersh
    Participant

    thank you so much!!!!!!!!!!!!!!!!!!!!!! it working :heart:

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.