Help with your scripting

entity.lookatObject()

entity.lookatObject()

Postby ant0N » 24 Jul 2015, 16:12

Hi! :)
I'm using entity.lookatObject(obj, target, 1, 0, 0, -1), but I am not able to constrain the rotation only along the y-axis.
Sorry for my English. :)
User avatar
ant0N
Skyline Moderator
Skyline Moderator
 
Posts: 415
Joined: 02 Nov 2012, 12:49
Location: Россия, Москва
Skill: Programmer
Skill: 3D Modeller

Re: entity.lookatObject()

Postby StarFire » 24 Jul 2015, 17:09

Is this the original demo code?
If not we can see if we can replicate the problem, can you post you script :)
Dream the Journey, Live the Experience!
User avatar
StarFire
Skyline Founder
Skyline Founder
 
Posts: 1678
Joined: 03 Jan 2012, 18:50
Location: UK
Skill: Great creative
Skill: Programmer
Skill: 3D Modeller
Skill: 2D Artist
Skill: Level Designer

Re: entity.lookatObject()

Postby ant0N » 24 Jul 2015, 17:25

sent the scene of a personal message.
Sorry for my English. :)
User avatar
ant0N
Skyline Moderator
Skyline Moderator
 
Posts: 415
Joined: 02 Nov 2012, 12:49
Location: Россия, Москва
Skill: Programmer
Skill: 3D Modeller

Re: entity.lookatObject()

Postby SolarPortal » 24 Jul 2015, 19:53

Replace the object lookat line with this

Code: Select all
   entity.setRotation(obj, 0,0,0);
   yawDeg       = entity.getHeading(obj, target);
   entity.yaw(obj, yaw+180, 0);


It isnt perfect but it will get you going.
They are not lerping though, they would be accurate :)
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
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

Re: entity.lookatObject()

Postby ant0N » 25 Jul 2015, 08:53

thanks SolarPortal, it works! :D

another question:
how to use this command - controller.setMoveDirection()?
the documentation is empty. I tried to use it instead of the controller.move(), but it's not working.
I'm just looking for an analogue of the entity.move(obj,x,y,z). :)
Sorry for my English. :)
User avatar
ant0N
Skyline Moderator
Skyline Moderator
 
Posts: 415
Joined: 02 Nov 2012, 12:49
Location: Россия, Москва
Skill: Programmer
Skill: 3D Modeller

Re: entity.lookatObject()

Postby SolarPortal » 25 Jul 2015, 10:17

controller.setMoveDirection is coded, but it currently has a boolean flag that is set to true all the time forcing it to use the simple movement. I am rectifying this now ;)

Note: There is 2 types of character controller.
- controller.function() is for spawned Character controllers (DCC);
- character.function() is for action based character controllers.

Edit: All coded up now, just need to test it :)
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
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

Re: entity.lookatObject()

Postby ant0N » 25 Jul 2015, 11:15

this will work in the next update? :)
Sorry for my English. :)
User avatar
ant0N
Skyline Moderator
Skyline Moderator
 
Posts: 415
Joined: 02 Nov 2012, 12:49
Location: Россия, Москва
Skill: Programmer
Skill: 3D Modeller

Re: entity.lookatObject()

Postby SolarPortal » 25 Jul 2015, 11:18

it should be & i'm aiming for that :D Will let you know in an hour or so whether it works.
Just got a couple of things to do atm. :)
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
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

Re: entity.lookatObject()

Postby ant0N » 25 Jul 2015, 11:31

ok, thanks!! :D
Sorry for my English. :)
User avatar
ant0N
Skyline Moderator
Skyline Moderator
 
Posts: 415
Joined: 02 Nov 2012, 12:49
Location: Россия, Москва
Skill: Programmer
Skill: 3D Modeller

Re: entity.lookatObject()

Postby SolarPortal » 25 Jul 2015, 12:23

ok, so i have tested the simple character controller and this is working.

Simple Character Controller Action: - This is possible now minus the new code
The action has a boolean value for simple move that you can already use to engage the move direction, but i have also added this command:

Code: Select all
character.setMoveAdvanced( obj, 1); -- 1 = custom manual movement, 0 = basic movement(dafault)


when the movement is set to advanced, you have to manually create the directions to apply, this also means you have to simulate your own gravity. Here is how you use the setMoveDirection.

Code: Select all
character.setMoveDirection( obj, 0, -1 ,1);
character.move( obj, 1000*timeDelta);


Note: You still have to call move afterwards to engage in the direction of your choice. 1 forwards, -1 backward. 0 no movement.

I will update this post with the spawned controller which i am going to test now :)

Edit:

Dynamic Spawned Character Controller: - not possible until the next release
This also works now:

Call this command to engage advanced movement:
Code: Select all
controller.setMoveAdvanced( dccID, 1);


Then use it like the other code:
Code: Select all
      
controller.setMoveDirection( dccID, 0, -1 ,1);
controller.move( dccID, 100*timeDelta);


Just remember, using the advanced mode will mean you have to control all direction of movement as the system will not move it and leave it acting as a kinematic body for you to program in your way.

Hope this helps :D
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
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

Re: entity.lookatObject()

Postby ant0N » 25 Jul 2015, 13:25

thank you SP! I look forward to the next release... :D :D :D
Sorry for my English. :)
User avatar
ant0N
Skyline Moderator
Skyline Moderator
 
Posts: 415
Joined: 02 Nov 2012, 12:49
Location: Россия, Москва
Skill: Programmer
Skill: 3D Modeller


Return to Lua Scripting

Who is online

Users browsing this forum: No registered users and 2 guests