﻿ What object is this cross in a circle?

• 0 Vote(s) - 0 Average
• 1
• 2
• 3
• 4
• 5
 What object is this cross in a circle? tomaszkax86 TerranovaTeam member Posts: 157 Threads: 5 Joined: Mar 2013 Reputation: 60 #7 03-18-2016, 07:04 PM After you detected object using radar(), you can access its orientation easily: Code:```object item = radar(Target2); float angle = item.orientation;``` Angle in degrees can be used in sin() and cos() to compute Cartesian direction. In standard math: Code:```float radius = 5.0f; float dx = radius * cos(angle); float dy = radius * sin(angle);``` dx and dy will be the change you need to apply to position. radius is the distance from the object. You can add dx and dy directly to base position and obtain where you need to move: Code:```point pos = tar2.position; pos.x += dx; pos.y += dy;``` I'm not sure if it will work like this in CBot because coordinates or orientation might be different, so you might have to test this and adapt if necessary. "After three days without programming, life becomes meaningless." ~The Tao of Programming « Next Oldest | Next Newest »

 Messages In This Thread What object is this cross in a circle? - by Rinoldo - 03-18-2016, 10:43 AM RE: What object is this cross in a circle? - by krzys_h - 03-18-2016, 11:04 AM RE: What object is this cross in a circle? - by Rinoldo - 03-18-2016, 11:34 AM RE: What object is this cross in a circle? - by tomaszkax86 - 03-18-2016, 12:50 PM RE: What object is this cross in a circle? - by Rinoldo - 03-18-2016, 02:52 PM RE: What object is this cross in a circle? - by krzys_h - 03-18-2016, 02:51 PM RE: What object is this cross in a circle? - by tomaszkax86 - 03-18-2016, 07:04 PM RE: What object is this cross in a circle? - by Rinoldo - 03-19-2016, 04:32 AM RE: What object is this cross in a circle? - by melex750 - 03-19-2016, 07:20 AM RE: What object is this cross in a circle? - by Rinoldo - 03-19-2016, 03:59 PM RE: What object is this cross in a circle? - by Simbax - 03-19-2016, 05:02 PM RE: What object is this cross in a circle? - by Rinoldo - 03-26-2016, 06:05 PM RE: What object is this cross in a circle? - by krzys_h - 03-26-2016, 06:25 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)