Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

3D Rotation Help

Is there anyway that I can stop a 3D model that is rotating moving from it’s original coordinates??

Thanks in advance :)


  • edited September 2021 Posts: 2,572

    @Creator27 - if you are rotating around a fixed point you shouldn’t be seeing the object move - that is unless you are moving the camera or using physics on the object.

    Can you post code so that we can see what you are trying to do.

  • @Bri_G, sure. Here’s the code I’m trying to fix:

    In function setup()

    sea = scene:entity()
        sea.model = craft.model(asset.documents.Dropbox.Donut)
        sea.position = vec3(0, -0.093, -0.06)
        sea.eulerAngles = vec3(0, 0, 0)
        sea.scale = vec3(0.045, 0.045, 0.045) / 8
        sea.material = craft.material(asset.builtin.Materials.Standard) = readImage(asset.builtin.Blocks.Lava)
        sea.material.offsetRepeat = vec4(6.0, 6.0, 5.0, 5.0)

    In function setup() as well:

    lavaRot = 0

    In function update():

    lavaRot = lavaRot + 0.04
    sea.rotation = quat.eulerAngles(0, 0, lavaRot)
  • Posts: 187

    Two ways:

    1. Some models have the "offset" property(just like craft.cube, craft.plane), its original value is vec3(0,0,0), you can easily change it to any value you want, then change the model’s rotation, it will rotate around the new offset;

    2. Some models without the "offset", you need to add a additional parent entity to the model’s entity, then set the parent entity’s rotation value to the one which you want to rotate around, at last rotate the parent entity, your model will rotate.

    The detail code you can see this post:

Sign In or Register to comment.