gennadiy Posted March 3, 2015 Posted March 3, 2015 Hello, friends! I'm new in Leadwerks Game Engine and I need help. Previously, I have programmed in Unity3D. So what's the problem - I need to create the object after the collision object to the scene and turn it as well as the collision surface (normal). On the Unity I wrote: void OnCollisionEnter (Collision col) { if (col.gameObject.CompareTag("Scene")) { ContactPoint contact = col.contacts[0]; Transform Obj = Instantiate(Object, contact.point, Quaternion.FromToRotation(Vector3.up, contact.normal)) as Transform; } } and how i can do this on Leadwerks? function Script:Collision(entity, position, normal, speed) local collisiontype = entity:GetCollisionType() if collisiontype==Collision.Scene then local obj = Prefab:Load("Prefabs/Object.pfb") obj :SetPosition(position + normal * 0.1) end end But how i can rotate object? Sorry for my bad English and noob question ((( Quote
gennadiy Posted March 3, 2015 Author Posted March 3, 2015 Oh, I founded this: obj:AlignToVector(normal, 1) Sorry Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.