Ooops
July 26, 2021, 15:23:05

Author Topic: Can a raycast detect a clone?  (Read 425 times)

Offline Pfaber11

  • Hero Member
  • *****
  • Posts: 747
  • Bonjour
Can a raycast detect a clone?
« on: April 22, 2021, 18:20:04 »
Good evening . was wanting to know can a raycast between an object clone and an object detect a hit . If not I have a lot of work to do planting trees.
The reason is I have made 1000 tree clones and I need to know when I run into one of them . 
« Last Edit: April 22, 2021, 20:34:39 by Pfaber11 »
HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen.

Offline blinkok

  • Sr. Member
  • ****
  • Posts: 352
Re: Can a raycast detect a clone?
« Reply #1 on: April 22, 2021, 23:27:44 »
Yes. That should work. Not sure about an instance though

Offline MikeHart

  • Hero Member
  • *****
  • Posts: 791
Re: Can a raycast detect a clone?
« Reply #2 on: April 23, 2021, 06:41:49 »
From my AGK days I can confirm that it does.

Offline Pfaber11

  • Hero Member
  • *****
  • Posts: 747
  • Bonjour
Re: Can a raycast detect a clone?
« Reply #3 on: April 23, 2021, 07:30:33 »
Thanks for the feedback.
HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen.

Offline RemiD

  • Hero Member
  • *****
  • Posts: 1273
Re: Can a raycast detect a clone?
« Reply #4 on: April 23, 2021, 09:06:35 »
to make your procedure faster :
-use a distance check before doing the raycast check...
DualCore AMD E-450, 1646 MHz - 6 Go DDR3 1333 SDRAM - AMD Radeon HD 6320 Graphics (384 Mo) - Windows 7 Home Premium - DirectX 11.0

Offline Pfaber11

  • Hero Member
  • *****
  • Posts: 747
  • Bonjour
Re: Can a raycast detect a clone?
« Reply #5 on: April 23, 2021, 11:47:49 »
OK thanks will look into it.
HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen.

Offline RemiD

  • Hero Member
  • *****
  • Posts: 1273
Re: Can a raycast detect a clone?
« Reply #6 on: April 23, 2021, 20:32:42 »
if you are trying to position trees on a terrain (with reliefs), there should be a command to get the terrain height (or Y) at X,Z...
DualCore AMD E-450, 1646 MHz - 6 Go DDR3 1333 SDRAM - AMD Radeon HD 6320 Graphics (384 Mo) - Windows 7 Home Premium - DirectX 11.0

Offline blinkok

  • Sr. Member
  • ****
  • Posts: 352
Re: Can a raycast detect a clone?
« Reply #7 on: April 23, 2021, 22:15:37 »

Offline Pfaber11

  • Hero Member
  • *****
  • Posts: 747
  • Bonjour
Re: Can a raycast detect a clone?
« Reply #8 on: April 24, 2021, 15:23:36 »
I came up with another solution of how to do it and it works very well instead of cloning I have a small piece of code that makes and plants my trees randomly as  objects rather than clones and for checking hits I did something something very similar . Saved myself writing 1000's of lines of code . All working very well too. As for clones I had no luck in detecting hits when I run into the trees but the way I'm making the tree objects is just as fast and the hit detection works a treat.
HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen.

Offline blinkok

  • Sr. Member
  • ****
  • Posts: 352
Re: Can a raycast detect a clone?
« Reply #9 on: April 25, 2021, 02:03:12 »
If you use instances it only has one copy of the mesh

Offline Pfaber11

  • Hero Member
  • *****
  • Posts: 747
  • Bonjour
Re: Can a raycast detect a clone?
« Reply #10 on: April 25, 2021, 13:34:46 »
Thanks for all the replies I've now got a road going through the forest so far not too shabby. I'm 11 days into this project and have learnt a few new things . Have an excellent day.
HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen.

Offline Amon.

  • Full Member
  • ***
  • Posts: 240
  • What? There's no ceiling outside?
    • Amon.Pro
Re: Can a raycast detect a clone?
« Reply #11 on: April 25, 2021, 16:30:42 »
Thanks for all the replies I've now got a road going through the forest so far not too shabby. I'm 11 days into this project and have learnt a few new things . Have an excellent day.
I love stuff like this. Keep going. Keep improving. Keep learning. Achieve even greater. Have an excellent day too, m8!
Windows 10 Pro - 64GB DDR4 RAM - GEFORCE RTX 2080 TI 11GB - AMD RYZEN 9 3950X

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal