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.

Drag mouse to rotate controls

Home Forums Puzzles Drag mouse to rotate controls

Viewing 15 posts - 1 through 15 (of 24 total)
  • Author
    Posts
  • #70688
    vergecurious
    Customer

    Hi all,
    I have the puzzle below to drag rotate the scene in my simulation. I’m looking to do the following.
    1. control the speed of the drag.
    2. limit the rotation of the drag.
    3. return the scene to the home (beginning positon) whe you release the mouse button
    Any help will be appreciated.

    Attachments:
    You must be logged in to view attached files.
    #70690
    xeon
    Customer

    Ok just to be clear … you want to drag over your scene to rotate it vs rotating the camera?

    Xeon
    Route 66 Digital
    Interactive Solutions - https://www.r66d.com
    Tutorials - https://www.xeons3dlab.com

    #70692
    vergecurious
    Customer

    I already have a on click event for a 360 degree camera rotation around my primary object. I want the user to be able to rotate the entire scene by draging the mouse. Is rotating the camera better? I’m open to what is best.

    #70693
    vergecurious
    Customer
    #70694
    xeon
    Customer

    Its exceedingly rare I would suggest rotating a scene vs rotating the camera. Its easier to implement and its much more efficient and user friendly.

    The camera you want to use is an orbit camera which you are doing now.
    You can set the speed at which it rotates in the your Camera Properties Verge3D settings..there will be a rotation speed control value you can set.

    There are also vertical and horizontal rotation min and max limits you can set in the same panel.

    The only thing that you will have to write some puzzles for is the return to home after the mouse is let up after drag is done….but you are not going to use the drag puzzle.

    This can be done with a Tween camera from current position to your home position with the type set to spherical vs linear.

    You will need to use a Camera Target and a Camera Start Location (usually empties) marking these locations and then just tween to them once the camera (stops moving).

    What you can do is test the position of the camera using Get Object location (camera) and determine if its changed values in a given duration of X seconds. If the value hasn’t changed then you start the tween if it has then you don’t tween. Simple timer with an interval set to X. I would recommend killing the timer after you return back to the home position.

    Other things to consider:
    Your HDR image Neutral_Pop.hdr is 10,000 x 5000. This is excessively large and should be something much smaller.
    You also have this problem with Foam color and wall tile normal…both of which are 4096×4096.

    You are also using non Power of Two image sizes for decals etc. I would recommend putting all those textures into one POT image atlas.

    Your poly count is high and you are using a light. So your poly count is higher than it needs to be sitting at 3,867,480. Since you have an HDR background you should be able to ditch the light and improve performance. If you want the light effects and shadows you would be better served baking those in the maps … for efficiency sake.

    3D text – doesn’t work on Apple Intel based systems….just fyi.

    Hope this is helpful.

    • This reply was modified 2 months, 1 week ago by xeon.

    Xeon
    Route 66 Digital
    Interactive Solutions - https://www.r66d.com
    Tutorials - https://www.xeons3dlab.com

    #70725
    diederik
    Participant

    What you can do is test the position of the camera using Get Object location (camera) and determine if its changed values in a given duration of X seconds. If the value hasn’t changed then you start the tween if it has then you don’t tween. Simple timer with an interval set to X. I would recommend killing the timer after you return back to the home position.

    hi Xeon, could you eleborate how this approach works in puzzles? I’ve been trying to work out such a solution but haven’t succeeded so far..

    #70726
    kdv
    Participant

    You want to rotate the entire scene instead of using Orbit controls? :scratch:

    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.

    #70728
    vergecurious
    Customer

    All I want is to be able to rotate either the camera or scene to view about 120 degrees in each direction horizontally with a mouse drag.

    #70729
    vergecurious
    Customer

    Thank you for your in depth comments. I now have three cameras. I have one for the drag. One for the zoom and one for the rotation. I’m able to lock a camera vertically but not horizontally. Not sure what is going wrong. No matter the setting I have 360 degrees of rotation.

    #70731
    kdv
    Participant

    ~4 millions tris are too much for this scene :wacko:

    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.

    #70734
    xeon
    Customer

    Here are two options to choose from if you really want to drag rotate the object to make your scene move. The traditional way of doing this is the way KDV has outlined above.

    I personally prefer option 2.

    demo: https://v3d.net/t3v
    Zipfile with blend file:https://v3d.net/t40

    Overview:
    The scene has a large box representing the walls and floor. Box is single sided with normals flipped. I was being lazy.

    In the center of the box is Suzanne. Inside Suzanne is an Empty called Cam_Target. The starting position of the camera has an Empty called Cam_Start_Location. The Camera is parented to the Cam_Target. This allows the rotation of the Cam_Target and the camera will orbit correctly around the Suzzanne and the room.

    Additionally there are Rotation constraints on the Cam_Target they are set to -30 and 30. You can set them up however you want.

    I provided two puzzle options. Option 1 is super simple and Option 2 provides you more control.

    You can learn more about them here: https://www.youtube.com/watch?v=Fvz1CZleReE

    • This reply was modified 2 months, 1 week ago by xeon.
    • This reply was modified 2 months, 1 week ago by xeon.
    Attachments:
    You must be logged in to view attached files.

    Xeon
    Route 66 Digital
    Interactive Solutions - https://www.r66d.com
    Tutorials - https://www.xeons3dlab.com

    #70739
    vergecurious
    Customer

    Yeah, that’s what I thought. It doesn’t work.

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

    0 and 0 will not work. it’s the same as 0 and 360 :unsure: use -xx and +xx.

    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.

    #70742
    vergecurious
    Customer

    Working my way up I started with option 1. But the “drag rotate” puzzle does not give me a world option, only local and parent.

    #70743
    xeon
    Customer

    be sure you are using verge3D 4.5 or higher.
    Be sure to use them small blue gear in the drag rotate puzzle and turn on “use space option”

    Xeon
    Route 66 Digital
    Interactive Solutions - https://www.r66d.com
    Tutorials - https://www.xeons3dlab.com

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