Forward Vector
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()
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?
Yes, I think you are right. It may be trivial.
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.
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.
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?