Jump to content

Matching neighboring geometry


nittrus
 Share

Recommended Posts

And I spoke to soon, got the player mesh to stay upright by using actor.rotationQuaternion.x=actor.rotationQuaternion.z=0 in beforeSceneRender!

Now it doesn't want to walk up the hill rather than keep sliding down it, this should get interesting!

Link to comment
Share on other sites

21 minutes ago, nittrus said:

mesh.rotation rotates an object incrementally meaning that each time you call it, it adds on to the existing value it has set

No...

I swear you should look at my stuff... your beating a dead horse.

Link to comment
Share on other sites

2 minutes ago, Pryme8 said:

No...

I swear you should look at my stuff... your beating a dead horse.

Well that is how I've always seen it act, so, for me that is how it works, proving this just typing it into console watching the results it is in fact what happens even in a basic scene with no physics.. so you telling me no doesn't change reality sorry to say. Anyone have anything constructive to offer without becoming rude and arrogant? Thanks..

Link to comment
Share on other sites

Your telling someone who knows better they are wrong... usually is considered rude in its self, your asking for help yet are not taking any of the steps to learn the correct way to do things, Im glad you solved it with quats, but from what you have been describing as your problems are all rookie mistakes, and I am a veteran with a solid portfolio sooooooo maybe it would behoove you to listen a little and not be a prat.

Much love, I will not be posting on this thread anymore...

Link to comment
Share on other sites

3 minutes ago, Pryme8 said:

Your telling someone who knows better they are wrong... usually is considered rude in its self, your asking for help yet are not taking any of the steps to learn the correct way to do things, Im glad you solved it with quats, but from what you have been describing as your problems are all rookie mistakes, and I am a veteran with a solid portfolio sooooooo maybe it would behoove you to listen a little and not be a prat.

Much love, I will not be posting on this thread anymore...

Veteran or not, doesn't warrant arrogance on such levels, so please do move on, I would rather have assistance from someone less veteran if it means not being talked down at like some inferior being as you come across. I'm not dumb as you seem to think, I been programming for over 20 years and am a member of Mensa but it doesn't mean I automatically know everything about BabylonJS out of the box nor does it mean everything is readily available in documentation, tutorials or in the forums, so good day sir!

Link to comment
Share on other sites

OK so here is what I ended up doing to get the terrain tiles to "stitch" together, best i can explain it..

I got the faceID's from each side of the current terrain tile, since these are always going to be the same, I placed them into an array.
So the positive Z side (North) is n_narr = [32,64,etc.] and the negative Z side (South) is n_sarr = [2,4,etc.]

I then made the current terrain tile aware of it's neighbors by loading them into variables like so:

var n_n = scene.getMeshByID('0z0x');
var n_ne = scene.getMeshByID('32z32x');
var n_e = scene.getMeshByID('0z32x');
var n_se = scene.getMeshByID('-32z-32x');
var n_s = scene.getMeshByID('-32z0x');
var n_sw = scene.getMeshByID('-32z-32x');
var n_w = scene.getMeshByID('0z-32x');
var n_nw = scene.getMeshByID('32z-32x');

Then when I am modifying the current tile on say the north side, if I am affecting the closest broad face to the edge of the n_n tile, we then also modify the south tile that meets it, so n_narr[0] also modifies n_sarr[0] and so on thus each side is the same.

Note that in order for this to work you must set the neighboring tile to match the vertice of the current tile, not increase or decrease with it otherwise they can become out of sync.

The corners are trickier, but basically the same, you need to leave out a couple of faces from the sides for them to become corner affected, thus you don't end up with double adjustments at once. I will try to post an illustration of this once I have some time along with some code examples once I am done functionifying it.. yes that is now a word!

But to sum it up, you are matching up faces on one edge of the tile with the other then when you modify one of the faces on one side you modify the other side on the neighboring tile, so when you are updating north side of the current tile the south side faces of the neighbor to the north update to match what you are doing!

It actually ended up not being that hard to complete once I found the solution that worked, just took 3 days to find a way to get it to work, patience is a virtue! :)

Link to comment
Share on other sites

Now on the physics issue, also solved!

So I lowered the gravity to -2 and set the terrain friction to 100 and the player friction to 50 and the player mass to 0.2 and the player now moves up and over the terrain and slowly slides down if you stop moving granted it may need some small improvements, it's functional enough to be acceptable! :)

No you won't float off into space if you trip but if you want your character to jump you will have to counter the lack of gravity maybe with an equivalent amount of downward impulse just briefly so to not cause acceleration.

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...