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

Intersect(Ray, Capsule) #34

Open
shadd3 opened this issue Oct 8, 2018 · 1 comment
Open

Intersect(Ray, Capsule) #34

shadd3 opened this issue Oct 8, 2018 · 1 comment
Labels

Comments

@shadd3
Copy link

shadd3 commented Oct 8, 2018

hello,
thanks for your work.

I embeded your library within a native/android application
(Im3d on PC Version / my application runs correcly)
but on the android version, the axis selection does not work

due to an issue with Intersect (see t0 & t1 )

bool Context::gizmoAxisTranslation_Behavior(Id _id, const Vec3& _origin, const Vec3& _axis, float _snap, float _worldHeight, float _worldSize, Vec3* _out_)
{
......
		float t0, t1;  <===== here
		bool intersects = Intersect(ray, axisCapsule, t0, t1);  <===== here
		makeHot(_id, t0, intersects);  <===== here
......
}
bool Im3d::Intersect(const Ray& _ray, const Capsule& _capsule, float& t0_, float& t1_ <==== here) 
{
	//IM3D_ASSERT(false); // \todo implement
	return Intersects(_ray, _capsule);
}

t0 & t1 are not initialized & not filled by Intersect but used by makeHot
workarround : makeHot => /_depth < m_hotDepth &&/ or Intersect => /* t0_ = 0.0f; t1_ = 1.0f;*/

bool Context::makeHot(Id _id, float _depth, bool _intersects)
{
	if (m_activeId == Id_Invalid &&	/*_depth < m_hotDepth &&*/ <==== here _intersects && !isKeyDown(Action_Select)) {
		m_hotId = _id;
		m_appHotId = m_appId;
		m_hotDepth = _depth;
		return true;
	}
	return false;
}

or

bool Im3d::Intersect(const Ray& _ray, const Capsule& _capsule, float& t0_, float& t1_)
{
	//IM3D_ASSERT(false); // \todo implement
	t0_ = 0.0f;
	t1_ = 1.0f;
	return Intersects(_ray, _capsule);
}

regards

@john-chapman
Copy link
Owner

Hi - thanks very much for reporting this. As you noted it's a bug in Intersect(ray, capsule) - actually it's just not implemented!

For now I think I'll add your workaround (the second one) as a quick fix; it means that overlapping gizmos with capsule bounds won't work correctly (the hit will be on the first one you test, not the nearest one). I'll leave the issue open and rename it to match the core problem.

@john-chapman john-chapman changed the title android port : translation mode : axis / selection does not work Intersect(Ray, Capsule) Oct 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants