Aerion Posted August 4, 2017 Author Share Posted August 4, 2017 Any luck brother? @Pryme8 Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 4, 2017 Share Posted August 4, 2017 Have not been able to debug the facet data from coords yet. Quote Link to comment Share on other sites More sharing options...
jerome Posted August 4, 2017 Share Posted August 4, 2017 Facet data from coordinates rely on the mesh partitioning to be accurate. Remember to make your facets tinier than the partition blocks (or the blocks bigger than the facets) Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 4, 2017 Share Posted August 4, 2017 Can you show me @jerome in scene when you get a chance please. No rush internets out at the office today so I won't get to develop at all but hey a break never hurt anyone! Quote Link to comment Share on other sites More sharing options...
jerome Posted August 4, 2017 Share Posted August 4, 2017 something like this http://jerome.bousquie.fr/BJS/test/facetdata3.html ? Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 4, 2017 Share Posted August 4, 2017 I'll take a look when I get home thanks buddy. Quote Link to comment Share on other sites More sharing options...
Aerion Posted August 5, 2017 Author Share Posted August 5, 2017 Can't WAIT to see! <3 THANK YOU! <3 Mythros Quote Link to comment Share on other sites More sharing options...
Aerion Posted August 6, 2017 Author Share Posted August 6, 2017 Any luck my brother? Thank You! <3 Mythros Quote Link to comment Share on other sites More sharing options...
satguru Posted August 6, 2017 Share Posted August 6, 2017 @Mythros See if this helps. This just uses moveWithCollisions and some simple physics. https://ssatguru.github.io/Vishva.ts/public_html/index.html?world=demo2 You will see three planks at different angles. The first plank is less than 30 degree, the other two more than 30 degree. Use WASD or arrow keys to walk the AV over each of those planks. The AV slides down the more than 30 degree planks if its stops while walking up those planks. The slide slope limit is set to 30 degree. The code https://github.com/ssatguru/Vishva.ts/blob/master/src/ts/component/CharacterControl.ts The slide slope limit is set here https://github.com/ssatguru/Vishva.ts/blob/master/src/ts/component/CharacterControl.ts#L18 adam, Wingnut and Pryme8 3 Quote Link to comment Share on other sites More sharing options...
Aerion Posted August 9, 2017 Author Share Posted August 9, 2017 Yes, that helps. Infact, it is PERFECT! But do you have an easier example embedding the exact camera in this demo with the camera collisions, and the slope sliding functions? No offense meant at all by this but this source code is way too convoluted. Thank You! Mythros Quote Link to comment Share on other sites More sharing options...
adam Posted August 10, 2017 Share Posted August 10, 2017 2 hours ago, Mythros said: Yes, that helps. Infact, it is PERFECT! But LOL Pryme8 1 Quote Link to comment Share on other sites More sharing options...
satguru Posted August 10, 2017 Share Posted August 10, 2017 @Mythros The code is a bit convoluted because it is still work in progress. This was inline my main Vishva code. I separated it out into its own class to make it reusable. It is still not complete and I am not sure when I will be able to complete it. When I get some time I will put together a simple playground example to show how it can be used in its current state. The idea behind it is actually very simple. In each frame, based on walk speed, gravity etc., I decide by how much amount do I want to move the mesh in x, y and z direction. I then use moveWithCollision to move it by that amount. I then check to see by how much amount did it actually move. This provides some hint on what might be happening. I then take some action based on that. So lets say I want to move the mesh by -2 meter in y direction but if after moveWithCollision I see that it hasn't moved at all in that direction I then conclude that the mesh might be on ground But if I see that it did, actually, move by -2 meter, I then conclude it is in free fall and I start accelerating it down further For slope I compare the old and new position to calculate the slope by which the mesh moved in vertical plane. If the slope is less than the slope limit I move the mesh back to its old position else I let it slide down. Quote Link to comment Share on other sites More sharing options...
Aerion Posted August 10, 2017 Author Share Posted August 10, 2017 I'm actually ripping through it right now trying to make it simple adam 1 Quote Link to comment Share on other sites More sharing options...
satguru Posted August 10, 2017 Share Posted August 10, 2017 here's a playground example https://www.babylonjs-playground.com/#638Q6N use WASD and QE to move sphere around. with shift to run space to jump lines 31-33 is what you need for the functionality the CharacterControl itself is from line 40 onwards. Aerion 1 Quote Link to comment Share on other sites More sharing options...
Aerion Posted August 11, 2017 Author Share Posted August 11, 2017 Thank you bro! This is awesome! I have 3 questions. How can you detect if the player is climbing up the hill? What's up with the Camera? Why is it not colliding with the ground & I can't rotate it with the mouse buttons? A combination of the ArcRotateCamera & Follow Camera would be AMAZING! Here's my rendition : https://www.babylonjs-playground.com/#IW46XZ#4 Thanks so much! <3 Mythros Quote Link to comment Share on other sites More sharing options...
JohnK Posted August 11, 2017 Share Posted August 11, 2017 7 hours ago, Mythros said: Here's my rendition : In your PG you have a lot of unecessary code, all the canvas and engine bits are dealt with by the PG. Check out Satguru's structure for his PG. Also read this http://babylonjsguide.github.io/begins/Introducing_Babylonjs It will help make your PGs more readable for those who want to help. Quote Link to comment Share on other sites More sharing options...
Aerion Posted August 11, 2017 Author Share Posted August 11, 2017 https://www.babylonjs-playground.com/#IW46XZ#5 -- Fixed as best as I could as per @JohnK 's suggestion. Quote Link to comment Share on other sites More sharing options...
satguru Posted August 11, 2017 Share Posted August 11, 2017 @Mythros Regarding "How can you detect if the player is climbing up the hill?". Compare the Y position of mesh before and after MoveWithCollision. If it has increased then it means the mesh is being probably pushed up a slope. Regarding FollowCamera. ArcRotateCamera worked well for most of my use cases so I never looked into using FollowCamera. So I do not have much knowledge about that. I will eventually look into it but for now, unfortunately, you are on your own as regards that Quote Link to comment Share on other sites More sharing options...
Aerion Posted August 12, 2017 Author Share Posted August 12, 2017 @satguru How would I grab those values? Quote Link to comment Share on other sites More sharing options...
satguru Posted August 12, 2017 Share Posted August 12, 2017 @Mythros mesh.position.y Quote Link to comment Share on other sites More sharing options...
Aerion Posted August 12, 2017 Author Share Posted August 12, 2017 @satguru why does the player not continue to gain gravity as he's falling when holding the left / right or A / D keys in the air? The player just sorta' floats down after the jump and holding the A / D or left / right keys. Why when on the terrain as you travel up steeper parts of the terrain the gravity does not slowly increase until the player reaches a slightly less steep incline? https://www.babylonjs-playground.com/#IW46XZ#5 Thank you! <3 Mythros Quote Link to comment Share on other sites More sharing options...
Aerion Posted August 13, 2017 Author Share Posted August 13, 2017 @satguru I forgot the terrain has to be bigger in order to see this problem. So I made another rendition. https://www.babylonjs-playground.com/#IW46XZ#7 Quote Link to comment Share on other sites More sharing options...
jerome Posted August 13, 2017 Share Posted August 13, 2017 From the beginning of this post, I don't get why you don't use the BJS provided GroundMesh class what provides the ground altitude AND the ground normal at any coordinates (x, z) in the world ... example : http://jerome.bousquie.fr/BJS/demos/getHeightAtCoordinates.html Quote Link to comment Share on other sites More sharing options...
Aerion Posted August 14, 2017 Author Share Posted August 14, 2017 Because @satguru's demo is what I'm looking for. @satguru I tried to figure out checking if the player is climbing up the slope & can't seem to figure it out. Here's my rendition : https://www.babylonjs-playground.com/#IW46XZ#11 Lines 298 - 312 oldposy = this.avatar.position.y; this.moveVector.copyFromFloats(0, -this.downDist, 0); this.avatar.moveWithCollisions(this.moveVector); posy = this.avatar.position.y; if ( posy > oldposy ) { console.log ( 'YAY!' ); } Quote Link to comment Share on other sites More sharing options...
satguru Posted August 14, 2017 Share Posted August 14, 2017 On 8/13/2017 at 6:53 AM, Mythros said: @satguru I forgot the terrain has to be bigger in order to see this problem. So I made another rendition. https://www.babylonjs-playground.com/#IW46XZ#7 Do not see the sphere falling down in air. Do not see the problem. If you check my demo you can see the AV accelerate down when it walks off the planks 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.