Is there a script to put in an axle to make this occur?
			8 posts			 • Page 1 of 1		
	
Is there a script to put in an axle to make this occur?
hi everyone, sorry if you've seen me everywhere, i just wanted to ask, is there a script that you can put in an axle to make it rotate to a particular angle, and by hotkey; also when you press that hotkey again it goes back to the original spot? i only ask this so I can make a transformer for myself, and my friend, and also make something simply rotate to a particular angle, like 90 degree or 140 degree, thank you everyone!
			
		- sandhaul
- Posts: 14
- Joined: Mon Dec 05, 2016 12:48 am
Re: Is there a script to put in an axle to make this occur?
Not hard. Just use BendTarget.
			
(/)(°,,,°)(/)
- 
				 
 pnvv
- Posts: 670
- Joined: Tue Aug 26, 2014 11:46 pm
- Location: Disunited States of America
Re: Is there a script to put in an axle to make this occur?
can you give me the script to put into it?
			
		- sandhaul
- Posts: 14
- Joined: Mon Dec 05, 2016 12:48 am
Re: Is there a script to put in an axle to make this occur?
In hinge's script menu:
			- Code: Select all
- bend = true;
 bendTarget = 1;
 bendConstant = 50000;
 motorTorque = 50000;
 onKey = (e) => {e.pressed ? {
 e.keyCode == "a" ? {
 bendTarget == 1 ? {bendTarget =2}:{bendTarget = 1}
 }:{}
 }:{}}
Dream of Algodoo as game development engine...
		- 
				 
 Kilinich
- [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: Is there a script to put in an axle to make this occur?
Thanks, kilinich!
			
		- sandhaul
- Posts: 14
- Joined: Mon Dec 05, 2016 12:48 am
Re: Is there a script to put in an axle to make this occur?
how do i set what angle it can bend to? thank you.
			
		- sandhaul
- Posts: 14
- Joined: Mon Dec 05, 2016 12:48 am
Re: Is there a script to put in an axle to make this occur?
bendTarget is angle in radians.
You could add some constant variables to store angles:
			You could add some constant variables to store angles:
- Code: Select all
- _angle1 = math.pi /4;
 _angle2 = math.pi /2;
 bend = true;
 bendTarget = _angle1;
 bendConstant = 50000;
 motorTorque = 50000;
 onKey = (e) => {e.pressed ? {
 e.keyCode == "a" ? {
 bendTarget == _angle1 ? {bendTarget = _angle2}:{bendTarget = _angle1}
 }:{}
 }:{}}
Dream of Algodoo as game development engine...
		- 
				 
 Kilinich
- [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: Is there a script to put in an axle to make this occur?
thanks kilinich.
			
		- sandhaul
- Posts: 14
- Joined: Mon Dec 05, 2016 12:48 am
			8 posts			 • Page 1 of 1		
	Who is online
Users browsing this forum: No registered users and 2 guests




