touslecoq Posted November 23, 2016 Share Posted November 23, 2016 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 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 23, 2016 Share Posted November 23, 2016 Hey! You can still have the ground but make it invisible Quote Link to comment Share on other sites More sharing options...
touslecoq Posted November 23, 2016 Author Share Posted November 23, 2016 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 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 23, 2016 Share Posted November 23, 2016 This sounds expected to me. The overall process was though to work on a non co-linear way You can use a cube (but in this case you will have to rewrite the algorithm) Quote Link to comment Share on other sites More sharing options...
touslecoq Posted November 23, 2016 Author Share Posted November 23, 2016 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. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.