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

Transform.xform() and Transform.xform_inv() methods are missing #719

Closed
Bauxitedev opened this issue Apr 4, 2021 · 2 comments · Fixed by #791
Closed

Transform.xform() and Transform.xform_inv() methods are missing #719

Bauxitedev opened this issue Apr 4, 2021 · 2 comments · Fixed by #791
Labels
c: core Component: core (mod core_types, object, log, init, ...) feature Adds functionality to the library help wanted
Milestone

Comments

@Bauxitedev
Copy link

Bauxitedev commented Apr 4, 2021

In Godot, you can call Transform.xform(v) to apply the transform to v (where v can be a vector, plane, AABB or vector array), and xform_inv to apply the inverse transform. See https://docs.godotengine.org/en/stable/classes/class_transform.html#class-transform-method-xform

This method appears to be missing in the gdnative bindings: https://docs.rs/gdnative/0.9.3/gdnative/core_types/struct.Transform.html

@Bromeon Bromeon added c: core Component: core (mod core_types, object, log, init, ...) feature Adds functionality to the library help wanted labels Apr 4, 2021
@Waridley
Copy link
Contributor

Waridley commented Apr 4, 2021

Related: #290

@Demindiro
Copy link
Contributor

Demindiro commented Apr 4, 2021

For the xform function a trait with Mul as supertrait could be used, e.g.:

// mod.rs
pub trait XForm<T>: Mul<T> {
	fn xform(&self, with: T) -> Self::Output
	where
		Self: Sized
	{
		self * with
	}
}

// transform.rs
impl XForm<Vector3> for Transform {}

That way xform can also be used for multiple types without suffixing a type to it (e.g. xform_vector3), if that's desired.

@Bromeon Bromeon added this to the 0.10 milestone Aug 25, 2021
@Bromeon Bromeon linked a pull request Oct 5, 2021 that will close this issue
@bors bors bot closed this as completed in #791 Oct 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: core Component: core (mod core_types, object, log, init, ...) feature Adds functionality to the library help wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants