mcjScriptedCollider

Introduction

Elsewhere on this site i have a plugin named mcjCollider, it's very fast but it only works for PC users

Here i publish a collider script as a script so everyone can play

A colider is : you point an arrow at an object and the collider projects the arrow point exactly on the surface of specified objects

This will be used in the near future for A.I. Neural Network self-driving cars in a Daz Studio Scene

It can also be used to create plumbing with the help of mcjRibbons ot mcjPathTube or mcjTransport

================================================================================

History

================================================================================

November 24th 2018 12:42 AM - Release

================================================================================

Installation

================================================================================

The zip package is found at the bottom of this page

unzip it in your daz content folder,

typically :

C:\Users\USERNAME\Documents\DAZ 3D\Studio\My Library

once installed, it will appear in your content library, under

The Daz Script will be found in My Library / Scripts / mcasual

Starting with Windows 7 if you right click on the downloaded zip file

and select the [Extract All ....] pop-up menu item

you simply browse up to your Daz Studio Content Folder

and the files will fall in the proper folder

================================================================================

Use

================================================================================

The mcjCreateAScriptedCollider.dsa script

Optional: before running this script, select an object in the scene to collide-upon. we will call this our target.

This Script will create 2 pyramid-shaped props in the scene, the body of an arrow and the point of an arrow.

The arrow will be oriented exactly like your current view camera, and it will be positioned exactly where your view camera is located.

The arrow will be resized to the distance between your viewpoint and the target .

If no object was selected before running the script, the arrow will be 100 cm long.

If a target was selected, the collider-worker-script will be invoked once.

if the arrow inteed points at the surface of the target, the arrow will be resized to stop exactly at the collision point.

note: this script has no User interface.

The secrets of the arrow

The arrow body and arrow point are two separate objects each with its own origin

The origin of the arrow body is at the base of the pyramid, the origin of the arrow point is at the apex of the pyramid

why? when the collider worker script will be used, the position and orientation of the body will not be changed, and the arrow point will be at the collision location

so you can parent the body of the arrow to a camera, animate the camera and for each frame of the animation run the collider-worker-script

this is how the tube in Figure 1. was laid out.

The mcjScriptedColliderWorker.dsa script

This script also has no User Interface,

it is meant to be repeatedly put in action by what we will call a collider-app

But, you can also use it standalone

1 - select the body of the collider-arrow you created earlier using mcjCreateAScriptedCollider

it must be the first object selected

2- add to the selection the target objects to be collided upon,

you can select body parts which will be way way faster than selecting a whole figure

because the collider-worker-script has to process each one of the facets of the target object(s);

run mcjScriptedColliderWorker.dsa

if your target is a few primitives, processing will take a fraction of a second

if your target is a figure processing may take many seconds

if the arrow inteed points at the surface of the target, the arrow will be resized to stop exactly at the collision point.

A collider-App : mcjScriptedColliderManager

This script will repeatedly invoke the mcjScriptedColliderWorker script

1 - select the body of the collider-arrow you created earlier using mcjCreateAScriptedCollider

it must be the first object selected

2- add to the selection the target objects to be collided upon,

you can select body parts which will be way way faster than selecting a whole figure

because the collider-worker-script has to process each one of the facets of the target object(s);

run mcjScriptedColliderManager.dsa

Specify a range of frames to be processed

Press the [Do It] button;