Help with your scripting

[DECIDED] turn one object to the other?

[DECIDED] turn one object to the other?

Postby ant0N » 12 Mar 2013, 06:54

turn one object to the other. how to do this?
for example
entity.point(entity1, entity2)
Last edited by ant0N on 12 Mar 2013, 11:29, edited 1 time in total.
User avatar
ant0N
Skyline Moderator
Skyline Moderator
 
Posts: 415
Joined: 02 Nov 2012, 12:49
Location: Россия, Москва
Skill: Programmer
Skill: 3D Modeller

Re: превратить один предмет в другой?

Postby ant0N » 12 Mar 2013, 11:28

decided with the help of
Code: Select all
entity.lookatObject
User avatar
ant0N
Skyline Moderator
Skyline Moderator
 
Posts: 415
Joined: 02 Nov 2012, 12:49
Location: Россия, Москва
Skill: Programmer
Skill: 3D Modeller

Re: [DECIDED] turn one object to the other?

Postby SolarPortal » 12 Mar 2013, 14:15

sorry for not responding sooner :P

entity.lookatObject is the best way to use the script.

Code: Select all
targetID = 5;
rotateSpeed = 300;
rotFactor = 1/rotateSpeed;

function onUpdate()
    rotProgress = rotProgress + rotFactor;
    if(rotProgress >= 1)then
        rotProgress = 0;
    else
        entity.lookatObject(obj, targetID, rotProgress, 0, 0, 1);
    end
end


There is also a more complex method that gives you far more control and uses quaternion SLerps.

you can find a demo at:
Skyline_SDK\Asset Library\Scripts\Example Scripts\AI\LookatObject.lua

There is a scene entity action in the system which has several lookat options from head turnbones to objects pointing at other objects, or make the objects look at the camera.

This action is located in the:
ActionEditor->Entity Group->Entity - Lookat
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer


Return to Lua Scripting

Who is online

Users browsing this forum: No registered users and 5 guests

cron