public MoleculeComponent(ComponentDef componentDef, Molecule _molecule) { definition = componentDef; molecule = _molecule; state = (definition.states == null || definition.states.Length < 1) ? "" : definition.states[0]; localTransform = new RelativeTransform(componentDef.transformOnMolecule); }
public virtual void MoveToComplex(Complex _complex) { RelativeTransform _worldTransform = new RelativeTransform(worldTransform); complex.RemoveMolecule(this); complex = _complex; localTransform = complex.reactor.GetLocalTransform(complex.position, complex.rotation, _worldTransform); }
public Molecule(MoleculePattern moleculePattern, RelativeTransform _localTransform, Complex _complex) { localTransform = new RelativeTransform(_localTransform); complex = _complex; definition = moleculePattern.moleculeDef; collisionRadius = interactionRadius = definition.radius; interactionRadius += 1f; CreateComponents(moleculePattern); SetColorForCurrentState(); }
public RelativeTransform GetParentWorldTransform(RelativeTransform childWorldTransform, RelativeTransform childLocalTransform) { childTransform.SetParent(parentTransform); childTransform.localPosition = childLocalTransform.position; childTransform.localRotation = Quaternion.Euler(childLocalTransform.rotation); childTransform.SetParent(transform); parentTransform.SetParent(childTransform); childTransform.position = childWorldTransform.position; childTransform.rotation = Quaternion.Euler(childWorldTransform.rotation); parentTransform.SetParent(transform); return(new RelativeTransform(parentTransform.position, parentTransform.rotation.eulerAngles)); }
public RelativeTransform GetLocalTransform(Vector3 parentWorldPosition, Quaternion parentWorldRotation, RelativeTransform childWorldTransform) { parentTransform.position = parentWorldPosition; parentTransform.rotation = parentWorldRotation; childTransform.position = childWorldTransform.position; childTransform.rotation = Quaternion.Euler(childWorldTransform.rotation); childTransform.SetParent(parentTransform); Vector3 childLocalPosition = childTransform.localPosition; Vector3 childLocalRotation = childTransform.localRotation.eulerAngles; childTransform.SetParent(transform); return(new RelativeTransform(childLocalPosition, childLocalRotation)); }
public RelativeTransform GetWorldTransform(Vector3 parentWorldPosition, Quaternion parentWorldRotation, RelativeTransform localTransform) { parentTransform.position = parentWorldPosition; parentTransform.rotation = parentWorldRotation; childTransform.position = parentTransform.TransformPoint(localTransform.position); childTransform.rotation = parentTransform.rotation * Quaternion.Euler(localTransform.rotation); return(new RelativeTransform(childTransform.position, childTransform.rotation.eulerAngles)); }
public void SetWorldTransform(RelativeTransform worldTransform) { complex.SetWorldTransform(complex.reactor.GetParentWorldTransform(worldTransform, localTransform)); }
public void SetWorldTransform(RelativeTransform worldTransform) { mover.SetWorldTransform(worldTransform); }
public RelativeTransform(RelativeTransform _relativeTransform) { position = _relativeTransform.position; rotation = _relativeTransform.rotation; }
public void SetWorldTransform(RelativeTransform worldTransform) { position = worldTransform.position; rotation = Quaternion.Euler(worldTransform.rotation); }