Jump to content

Drag and Drop Without Ground Mesh


touslecoq
 Share

Recommended Posts

Hey all

I've used the standard method for drag and dropping meshes in my app (ie the one with the getGroundPosition function.)  

it works fine.  However I don't really like it - I don't want to have a ground plane in the scene as the user is building up building blocks and is able to rotate the camera all around the evolving structure and make changes.  The ground plane gets in the way of this.

So - has anyone come up with an alternative strategy for this?  If I remove the ground mesh it does kind of work but is glitchy - the mesh being dragged suddenly starts moving toward or away from the camera randomnly as there is no ground mesh to use as an 'anchor'.

I'll have a play but wondered if the brains behind this operation had any thoughts ... would having the scene inside some kind of giant 'universe' cube, where the sides of the cube form the background and the boundaries of the scene, work?  I guess if the user ventured towards the edges of the cube they could still end up intersecting with it and seeing odd behaviour.

Cheers

Rich

Link to comment
Share on other sites

Hey Dk.  Thanks.  I have tried that and actually I am wondering if there is some other issue contributing to the issue I am seeing.

I think there are 2 symptoms:

1 - when camera (arc rotate) is rotated so that it approaches being co-linear with the ground plane (ie close to ground level), the getGroundPosition stops working as ground is no longer behind the mesh being dragged (ie the sky - no plane - is behind the dragged mesh).  I tried doing it inside a cube and had some luck but results were a bit sporadic - possibly related to point 2.

2 - aside from point 1 I am still seeing the mesh randomly move closer or farther from the camera as I drag.  I am still experimenting but its seems to do this when the ground mesh (or the cube inner wall see point 1) is at an angle to the camera (ie the camera is not directly above and facing the ground).  If I am correct I assume this is because when at an angle the 'ground' plane is closer or farther from the camera depending on the screen x,y coordinates.  Only when the camera faces the ground mesh perpendicularly does this not occur.

Is this normal behaviour or does it sound like something wrong with my implementation?  Would having the ground plane move with the camera so that it is always perpendicular to the camera and always at a set distance from the camera?

I will try and replicate in a playground to illustrate but thoughts appreciated...

Rich

Link to comment
Share on other sites

Thanks - I think you are right - having just played with a basic version it in the playground it is exhibiting similar behaviour.  The reason mine looks worse is because of the additional code it executes on the fly (ie checking for nearby meshes to snap to), it appears less smooth.  I therefore think the behaviour I am seeking is not standard.

As I drag components around in front of the camera I want them to remain in that same plane (ie remain same distance from the camera). I will create some functions to lock movement to the x,y and z axis for more precise movement.  

Thanks again Delta.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...