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

Forward Vector #63

Open
3 tasks
Xaniaro opened this issue Apr 11, 2021 · 5 comments
Open
3 tasks

Forward Vector #63

Xaniaro opened this issue Apr 11, 2021 · 5 comments
Labels
feature request New feature request

Comments

@Xaniaro
Copy link
Contributor

Xaniaro commented Apr 11, 2021

We need a function to calculate the forward vector. It is daily bread when you want to move some object in the direction its facing. Like this:
https://docs.unity3d.com/ScriptReference/Transform-forward.html
https://docs.unrealengine.com/en-US/BlueprintAPI/Utilities/Transformation/GetForwardVector/index.html

It will be handle to also implement up and right.

  • transform.forward()
  • transform.up()
  • transform.right()
@Xaniaro Xaniaro added the feature request New feature request label Apr 12, 2021
@QuantumEntangledAndy
Copy link
Contributor

Perhaps I am misunderstanding this but isn't this just forward in local space but translated to world space? Can't this computed trivially with the object transform matrix and some units vectors?

@Xaniaro
Copy link
Contributor Author

Xaniaro commented Jan 19, 2022

Yes, I think you are right.
It may be trivial.

@QuantumEntangledAndy
Copy link
Contributor

QuantumEntangledAndy commented Jan 21, 2022

The only complication I could see would be if we had a parenting system. In which case we would have to transverse up the tree to learn the combined world matrix.

Where would we want such a transform.forward() to reside? Part of the Transform component?

Should we implement it now or wait until we have Parent components?

If we add a parent component I would except we would need read access to World so that we could look up the transforms and parents components recursivly.

@pixelijo
Copy link
Member

I was thinking about parenting. I see it using a new Parent component that will contain EntityId of a parent. For Parent entity itself it must present as well. The worst thing that may happen is if we will have to iterate over these entities twice in parenting system.

@QuantumEntangledAndy
Copy link
Contributor

QuantumEntangledAndy commented Jan 22, 2022

I was thinking of implementing my own Parent component but I couldn't seem to find a method in ecs that lets me grab the component if I know the Entity. The only way to grab comonents seemed to be with query which iterates everything did I miss something?

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

No branches or pull requests

3 participants