Jump to content


Photo

adding colliders


  • Please log in to reply
11 replies to this topic

#1 hiltonwelford

hiltonwelford

    Advanced Member

  • Members
  • PipPipPip
  • 134 posts
  • Locationnew zealand

Posted 27 September 2018 - 02:21 AM

how can i add a collider to a imported sketchup stone bridge? the ball  falls through it.

cheers hilton.



#2 bortimus

bortimus

    Advanced Member

  • Members
  • PipPipPip
  • 1,234 posts

Posted 27 September 2018 - 02:55 AM

At the bottom of the inspector for the bridge you will see a button for "Add Component"

Mtk4DWW.jpg

 

A box collider will likely be the best fit for the bridge.  

The collider will appear around the object (sometimes it needs to be adjusted a bit) 

Choose the desired physics material.  

Name the bridge "Spline xyz"  if you want players to be able to stand on it.  

 

Side note:  Complex or unusual shaped objects may need a combination of colliders taken from the primitive 3D gameobjects.  Mesh colliders can be computationally expensive depending on the mesh structure.    



#3 Kablammo11

Kablammo11

    Obscure Person

  • Members
  • PipPipPip
  • 3,953 posts

Posted 27 September 2018 - 10:34 AM

1. Click on the prefab of your object in the Assets Window. In the inspector, you will see a box that allows you to create colliders. Tick it.

 

BUQdOd0.jpg

 

2. When you then place that object into the scene, it appears in the Hierarchy - with a new feature. There, click on the tiny grey triangle in front of the object name to reveal the instance (named: "g0" by default - you may rename it to something else). Click on g0 to view it in the inspector. Add the desired physics material to the empty field saying Mesh Collider.

 

CkJGsF0.jpg

 

3. You now have an exact collider, because the wireframe of your object doubles as the trigger for collisions. If you do that right away with every object you import, you can then copy it as many times as you want - and all the copies will have colliders, too.


>>>>>>> Ka-Boom!





• Mulligan Municipal • Willow Heath • Pommeroy • Karen • Five Sisters • Xaxnax Borealis • Aroha • Prison Puttˆ

• The Upchuck   The Shogun  • Black Swan (•)

 

<<<<<


#4 bortimus

bortimus

    Advanced Member

  • Members
  • PipPipPip
  • 1,234 posts

Posted 27 September 2018 - 11:10 AM

Much better explanation K11.  

What are your thoughts on the cutoff for what objects should use mesh colliders or primitive colliders? 

Other than trees, do you feel most game objects are safe to use mesh colliders without a performance hit?  



#5 Kablammo11

Kablammo11

    Obscure Person

  • Members
  • PipPipPip
  • 3,953 posts

Posted 27 September 2018 - 11:48 AM

I'm not sure there is much of a performance hit at all, I certainly haven't noticed any so far - the object mesh needs to be loaded anyway to define the object, the additional task during the game of checking if a moving golf ball collides with it is probably not so performance-sapping - after all, that is how the game deals with all the ball bounces on the entire terrain as well.

Unless an object is truly out of range for any imaginable golf shot including uncontrolled shanks and vicious snap hooks, it should have a collider added - Myself, I routinely add it right upon importing the object, so this would probably mean, I suppose, that every object has a mesh collider assigned, no matter what.


>>>>>>> Ka-Boom!





• Mulligan Municipal • Willow Heath • Pommeroy • Karen • Five Sisters • Xaxnax Borealis • Aroha • Prison Puttˆ

• The Upchuck   The Shogun  • Black Swan (•)

 

<<<<<


#6 bortimus

bortimus

    Advanced Member

  • Members
  • PipPipPip
  • 1,234 posts

Posted 27 September 2018 - 12:10 PM

Perhaps I was being a bit conservative with the colliders.

I thought I read on a Unity forum that too many complex mesh colliders could impact performance, but as you said we don’t seem to experience that issue within PG.

Thanks for clarifying.

#7 Kablammo11

Kablammo11

    Obscure Person

  • Members
  • PipPipPip
  • 3,953 posts

Posted 27 September 2018 - 12:29 PM

Be honestly advised that I'm not nearly knowledgeable enough about this sort of stuff to have the last word on this matter. 

 

Did you mean this post?

https://forum.unity.com/threads/multiple-box-colliders-vs-mesh-collider.100335/

 

I can't give you any valid reason why you should value my opinion higher than all those posted in there. All I can state is that I did not observe any noticeable drop in performance when I added mesh colliders to my objects. Then again, all my objects are self-made with a slim low-poly policy strictly enforced - if you were to import objects with a high-poly count, thousands of polys instead of dozens, then perhaps this would be different.


>>>>>>> Ka-Boom!





• Mulligan Municipal • Willow Heath • Pommeroy • Karen • Five Sisters • Xaxnax Borealis • Aroha • Prison Puttˆ

• The Upchuck   The Shogun  • Black Swan (•)

 

<<<<<


#8 bortimus

bortimus

    Advanced Member

  • Members
  • PipPipPip
  • 1,234 posts

Posted 27 September 2018 - 12:52 PM

Yes I think that’s one of the threads I’ve read before.

The fact that speedtrees use primitive colliders makes me think there is a tipping point where mesh colliders are too resource intensive. Or maybe it’s that there are two different physics materials being used; wood and leaves... I’m not sure.

I think most of the community built objects are more optimized than things imported from Sketchup so the mesh collider issue isn’t as apparent in PG.

#9 hiltonwelford

hiltonwelford

    Advanced Member

  • Members
  • PipPipPip
  • 134 posts
  • Locationnew zealand

Posted 27 September 2018 - 07:30 PM

thanks guys. big help.



#10 jt83

jt83

    Advanced Member

  • Members
  • PipPipPip
  • 1,023 posts

Posted 25 April 2019 - 12:49 AM

I've placed part of a railroad into the scene but the 'g0' isn't appearing...

 

Maybe some kind soul could can advise on how to move a train along it as well?  I don't think there's been a tutorial on animation.



#11 jspirate

jspirate

    Advanced Member

  • Members
  • PipPipPip
  • 487 posts

Posted 25 April 2019 - 12:28 PM

I've placed part of a railroad into the scene but the 'g0' isn't appearing...

 

Maybe some kind soul could can advise on how to move a train along it as well?  I don't think there's been a tutorial on animation.

 

There is alot of info out there on animation. For a train, I think jimbobh's video is probably a good start:

 

https://drive.google...EFESXgxWDQ/view


i7-8700K
GIGABYTE Z390 AORUS Pro
64 GB DDR4 3200
MSI GeForce GTX 1080 Ti Gaming X
LG 32GK850G
Win 10 Home Premium on 1TB SSD

 

Courses:

Bradford Links - released

Ironwood - released

Cypress Landing - released (also available in a 3DG version)

Crow's Nest - released


#12 NoPutt

NoPutt

    Advanced Member

  • Members
  • PipPipPip
  • 2,902 posts
  • LocationSouth Carolina

Posted 25 April 2019 - 06:21 PM

For a Train I'd start with a long straight perfectly flat track.

Download a train from sketch up, scale, rotate, move the train

into position on the track. Move it along the track in the x or y axis

within unity to make sure the train is in fact aligned with the track,

then Animate it just like the video. Of course you can add an audio

to the train as well.

https://vimeo.com/332506725


Dry Gulch...................Released                     Smithfield Golf Club...........Released

Millstone Golf Club....Released                      The Walker Course............Released

Kingsmill Woods Course...Released               Pine Lake Golf Club..........Released

Woodhaven Golf Club (9) Released                The Reserve at Keowee...Released

Cliffs at Keowee Vineyards..Released              The Ace Club...................Released

Dry Gulch 2..........Released                               Blackberry Oaks.............Released

 





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users