Colider Box , vertical movment on chan element
I add chain with chain element, and make chain element as transfer surface. But when cans comes to chain element it is holding only in vertical moving , but not for horizontal, there is video, what i miss?
Answer
I never checked this kind of setup. Did you selected the follow parent option in G4A (https://game4automation.com/documentation/current/transportsurface.html#Transport-Surfaces-and-Unity-Physics),
Could you send me your example so that I could check it on my computer?
I send on email. it is same problem on DemoChain scen,Cans not moving in horisontal direction..
Here in transport surface need add absolute moving of transport surface byself + Transportdirection moving (in script only transport direction, and no moving of surface byself , rotation and linear) Have no idea yet how add surface object moving. Any idea?
if (speed != 0)
{
mov = TransportDirection * Time.fixedDeltaTime * speed *
Game4AutomationController.SpeedOverride /
Game4AutomationController.Scale;
_rigidbody.position = (_rigidbody.position - mov);
_rigidbody.MovePosition(_rigidbody.position + mov);
}
if (speed == 0)
{
mov = TransportDirection * Time.fixedDeltaTime * 100 *
Game4AutomationController.SpeedOverride /
Game4AutomationController.Scale;
_rigidbody.position = (_rigidbody.position - mov);
_rigidbody.MovePosition(_rigidbody.position + mov);
}
some like this working
void Start()
{
_distancepos = transform.position;
..........
if (true) //speed != 0)
{
mov = (transform.position - _distancepos) + TransportDirection * Time.fixedDeltaTime * speed *
Game4AutomationController.SpeedOverride /
Game4AutomationController.Scale;
_rigidbody.position = (_rigidbody.position - mov);
_rigidbody.MovePosition(_rigidbody.position + mov);
_distancepos = transform.position;
}
And in source script need add
newrigid.mass = Mass;
newrigid.interpolation = RigidbodyInterpolation.Interpolate;
I need to look deeper into the problem to implement a general solution. If I see it right you have got your solution. Thanks fir the hints. How is your transport surface script looking now in total?
Hi Thomas, Any news on a update for this?, I get the same problem when attempting to rotate a moving conveyor, i.e. while the rotation is active all other directional movements stop
We are preparing a new release for end of next week and it is planned to fix this.
i just add Cube on Carton object ,
And add script OnTrigPlatform with hardcode collisions on it.
Here is source code for script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class OnTrigPlatform : MonoBehaviour
{
public GameObject StandardParent;
#region Private Variables
private MeshRenderer _meshrenderer;
private Rigidbody _rigidbody;
private Collider _collider;
private bool _isMeshrendererNotNull;
private Transform _parent;
private int loaded;
private Vector3 _distancepos;
private Quaternion _distancerot;
#endregion
#region Private Methods
#endregion
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
private void OnTriggerEnter(Collider other)
{
Transform a;
string Name = other.gameObject.name;
if (Name == "conv" && loaded == 1)
{
//this.gameObject.transform.parent.gameObject.transform.parent = StandardParent.transform;
this.gameObject.transform.parent.gameObject.transform.parent = StandardParent.transform;
this.gameObject.transform.parent.gameObject.GetComponent().isKinematic = false;
this.gameObject.transform.parent.gameObject.GetComponent().useGravity = true;
//this.gameObject.transform.parent.gameObject.GetComponent().WakeUp();
//this.gameObject.transform.parent = StandardParent.transform;
//this.gameObject.transform.parent.gameObject.GetComponent().isKinematic = false;
loaded = 0;
}
if (Name == "Fork_001(Clone)" && loaded == 0)
{
//StandardParent = this.gameObject.transform.parent.gameObject;
//other.gameObject.transform.parent = this.gameObject.transform;
this.gameObject.transform.parent.gameObject.transform.parent = other.gameObject.transform;
this.gameObject.transform.parent.gameObject.GetComponent().isKinematic = true;
this.gameObject.transform.parent.gameObject.GetComponent().useGravity = false;
//StandardParent = this.gameObject.transform.parent.gameObject;
StandardParent = other.gameObject.transform.root.gameObject;
loaded = 1;
}
}
private void OnTriggerExit(Collider other)
{
string Name = other.gameObject.name;
if (Name == "Fork_001(Clone)" && loaded == 1)
{
// loaded = 0;
}
}
}
Not findeout better solution. But good enougth for tests
H, thanks very much for sharing. Nice work. We are working on it and will integrate a solution, next week most probably. In the this week release we had not enough time for this issue.
OK we found a solution. Thanks for sharing your information.
Here is a video about it, will be in the release next week. If you need the changed scripts earlier please send me a message.
Customer support service by UserEcho
OK we found a solution. Thanks for sharing your information.
Here is a video about it, will be in the release next week. If you need the changed scripts earlier please send me a message.
Transportsurface.mp4