How do I read only the speed on x-axis?
			3 posts			 • Page 1 of 1		
	
How do I read only the speed on x-axis?
Hi guys, I've been trying to make a new kind of suspension for cars and I need to determine the speed on only just one axis so that, then I can calculate the overall speed. 
So my question is how to "extract" only the first variable from the velocity[x,y] of an object?
Thank you electronicboy and Xray for answering me!
							So my question is how to "extract" only the first variable from the velocity[x,y] of an object?
Thank you electronicboy and Xray for answering me!
Last edited by RpT on Tue Aug 27, 2013 6:46 pm, edited 1 time in total.									
			Țăranul se uită la pământ și pământul la țăran..dacă are pământ, dacă nu, atunci nu!

		- RpT
 - Posts: 11
 - Joined: Sun Oct 02, 2011 4:45 pm
 
Re: How do I read only the speed on x-axis?
Arrays are done so that the first value is position 0, so, x - 0 and y - 1.
An example:
Scene.my.a = [1, 2, 3,]
Reading: scene.my.a(0) = 1
Reading: scene.my.a(1) = 2
			An example:
Scene.my.a = [1, 2, 3,]
Reading: scene.my.a(0) = 1
Reading: scene.my.a(1) = 2
When asking for help, READ THE STICKIES!
		- electronicboy
 - Posts: 1694
 - Joined: Mon Aug 31, 2009 6:18 pm
 
Re: How do I read only the speed on x-axis?
RpT wrote:So my question is how to "extract" only the first variable from the velocity[x,y] of an object?
For your specific example, it would be velocity(0)
The code would look something like this: scene.my.velX = velocity(0).
Unfortunately, you can only read an array element using an index. You cannot write to a single array element. For example, you CANNOT do velocity(0) = scene.my.velX. Many of us Thyme scripters have been begging for this fix for a long time, but it seems to fall on deaf ears.
- 
				

Xray - Posts: 501
 - Joined: Sun Jun 17, 2012 6:12 am
 - Location: USA
 
			3 posts			 • Page 1 of 1		
	Who is online
Users browsing this forum: No registered users and 3 guests



