Help with your scripting

Rotate

Rotate

Postby TattieBoJangle » 07 Jul 2015, 17:41

Hi guys can anyone help me out with a simple looping rotate script for a model where i can adjust the rotation speed thanks :)
Case: CM Storm Trooper CPU: I7 5930k X99 Cooler: Noctua NH-D15 Graphics: Asus GTX 1080 Motherboard: Rampage Extreme V x99 Ram: RipJaws DDR4 3000mhz Storage: x2 SSD Crucial 500GB + x5 2TB Hdd PSU: Evga 1500w OS: Windows 10
User avatar
TattieBoJangle
Community Manager
Community Manager
 
Posts: 858
Joined: 26 Jan 2015, 00:15
Location: United Kingdom
Skill: 3D Modeller
Skill: 2D Artist
Skill: Level Designer
Skill: Great creative

Re: Rotate

Postby SolarPortal » 07 Jul 2015, 17:48

Have you tried the entity-rotate action?
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: Rotate

Postby SolarPortal » 07 Jul 2015, 17:53

Here is a script anyway:

Code: Select all
speedX = 0;
speedY = 100;
speedZ = 0;

obj = 0;
function onInit(objID)
   sky.lprint("LUA: Script Active!");
   obj = objID;
end

function onUpdate( timeDelta )
   entity.turn(obj, speedX * timeDelta, speedY * timeDelta, speedZ * timeDelta);
end


Note: Actions will always run faster as they are created in c++. Lua scripts are not as fast.
I did a test a while back of a thousand entities rotating using an action and then the same with scripts.
the c++ ran at 200fps while the lua ran at 100fps.
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: Rotate

Postby TattieBoJangle » 07 Jul 2015, 17:54

hahah i forgot that even existed ty works like a charm :)
Case: CM Storm Trooper CPU: I7 5930k X99 Cooler: Noctua NH-D15 Graphics: Asus GTX 1080 Motherboard: Rampage Extreme V x99 Ram: RipJaws DDR4 3000mhz Storage: x2 SSD Crucial 500GB + x5 2TB Hdd PSU: Evga 1500w OS: Windows 10
User avatar
TattieBoJangle
Community Manager
Community Manager
 
Posts: 858
Joined: 26 Jan 2015, 00:15
Location: United Kingdom
Skill: 3D Modeller
Skill: 2D Artist
Skill: Level Designer
Skill: Great creative


Return to Lua Scripting

Who is online

Users browsing this forum: Google [Bot] and 2 guests