Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use offmesh connections? #35

Closed
royluo03 opened this issue Jun 28, 2021 · 6 comments
Closed

How to use offmesh connections? #35

royluo03 opened this issue Jun 28, 2021 · 6 comments

Comments

@royluo03
Copy link

Hi,

I've tested building NavMesh from a obj file which is exported from UE4.25. It works very well.

But I didn't pass the test for offmesh connections.

My test septs are:

  1. add an off mesh connection to input geometry.
  2. build nav mesh
  3. find path

My test codes for adding off mesh as below:

func (ig *InputGeom) AddOffMeshConnection(spos [3]float32, epos [3]float32, rad float32, bidir uint8, area uint8, flags uint16) {

if ig.offMeshConCount >= 256 {
	return
}

ig.OffMeshConnectionVerts()[ig.offMeshConCount*3*2] = spos[0]
ig.OffMeshConnectionVerts()[ig.offMeshConCount*3*2 + 1] = spos[1]
ig.OffMeshConnectionVerts()[ig.offMeshConCount*3*2 + 2] = spos[2]

ig.OffMeshConnectionVerts()[ig.offMeshConCount*3*2 + 3] = epos[0]
ig.OffMeshConnectionVerts()[ig.offMeshConCount*3*2 + 4] = epos[1]
ig.OffMeshConnectionVerts()[ig.offMeshConCount*3*2 + 5] = epos[2]



//fmt.Printf("OffMeshConnectionVerts: %v\n",soloMesh.geom.OffMeshConnectionVerts())

ig.OffMeshConnectionRads()[ig.offMeshConCount] = rad
ig.OffMeshConnectionDirs()[ig.offMeshConCount] = bidir
ig.OffMeshConnectionAreas()[ig.offMeshConCount] = area
ig.OffMeshConnectionFlags()[ig.offMeshConCount] = flags
ig.OffMeshConnectionId()[ig.offMeshConCount] = uint32(1000 + ig.offMeshConCount)


//m_offMeshConRads[m_offMeshConCount] = rad;
//m_offMeshConDirs[m_offMeshConCount] = bidir;
//m_offMeshConAreas[m_offMeshConCount] = area;
//m_offMeshConFlags[m_offMeshConCount] = flags;
//m_offMeshConId[m_offMeshConCount] = 1000 + m_offMeshConCount;

ig.offMeshConCount ++

}

please correct me.

Thanks

@arl
Copy link
Owner

arl commented Jun 28, 2021 via email

@royluo03
Copy link
Author

Hi
I'm gonna study original c++ code and try to port off mesh conn feature. Looking forward you can have time to get back on it :)

Thanks!

@arl
Copy link
Owner

arl commented Jun 29, 2021

Thanks @royluo03 that'd be awesome.
I think most of the functions might already have been ported. The porting is not really the hardest part, it's just tedious and long. The hardest is to test it.
Hint: use staticcheck and see what functions are marked as dead-code, that's probably because the functions that call them haven't been ported yet.
Let me know what you find

@royluo03
Copy link
Author

royluo03 commented Jul 2, 2021

code.zip
Hi,

My friend got something from original c++ code and did some adjustment in go code than we pass the off mesh test.

attached 3 adjusted codes please check it.

@arl
Copy link
Owner

arl commented Jul 2, 2021 via email

@royluo03
Copy link
Author

royluo03 commented Jul 2, 2021

Haven't use it before. I'm gonna try :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants