Plugin Cafe Homepage
Forum Home Forum Home > Plugin Cafe > SDK Help
  New Posts New Posts
  FAQ FAQ  Forum Search

Change object position based on displaced ground

Author
Message
  Topic Search Topic Search
NEON View Drop Down
Member
Member


Joined: 2015 Jul 23
Location: Austria
Online Status: Offline
Posts: 70
Direct Link To This Post Topic: Change object position based on displaced ground
    Posted: 2018 Mar 03 at 4:42am

User Information:

Cinema 4D Version:   R18.058 
Platform:   Windows  ;   Mac OSX  ; 
Language(s):     C++  ;  XPRESSO  ;  PYTHON  ; 

---------

Hello PluginCafe :),

I am creating an Ocean kit for my client and my current setup is a custom created shader in an displacer (wish from client). The displacer is applied to a plane object which is the ocean surface.

What I want to do, is to let an object float ontop of that surface. I was thinking on creating a tag-plugin for this to modify the objects position (and maybe rotation) depending on the displaced surface.

My question(s) now is(are): 
Is it actually possible to get the new points of the displaced object an set my whole (floating) object's position to them? Since my plane is not a point object and maybe needs to be resized and re-segmented by the end-user. 
What would be the best approach to do this?

I hope everything is clear, and someone is able to help me :)

best regards and thanks in advance,
Florian
Back to Top
knickknack View Drop Down
Forum Moderator
Forum Moderator


Joined: 2016 Jul 01
Location: Italy
Online Status: Offline
Posts: 268
Direct Link To This Post Posted: 2018 Mar 05 at 2:20am
Hi Florian, thanks for writing us.

Actually there are two options you can choose between:
  1. using the RayCollider library from our API you can sample the displaced ocean surface to identify real intersection on the surface and position your objects accordingly;
  2. given that you can access the displacing shader, if you convert the position of your floating object from the world space on the plane to UV space you have all the means to evaluate the shader at such UV; then the offset value obtained can be used to properly position the floating object on the displaced surface.


Best, Riccardo



Edited by knickknack - 2018 Mar 05 at 2:21am
MAXON Computer GmbH
SDK Support Team
Back to Top
NEON View Drop Down
Member
Member


Joined: 2015 Jul 23
Location: Austria
Online Status: Offline
Posts: 70
Direct Link To This Post Posted: 2018 Mar 07 at 1:01am
Hello Riccardo,

thank you very much for your input!

About the second option you mentioned:
How would I be able to translate my objects coordinates to UV coordinates?

Best, Florian
Back to Top

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.61 [Free Express Edition]
Copyright ©2001-2009 Web Wiz

This page was generated in 0.141 seconds.