SchemeExt:Entity:move

From DocR23

Jump to: navigation, search

Contents

Action

Transforms an entity or list of entities.

Filename

scm/scmext/kern/transform_scm.cpp

APIs

api_transform_entity, api_change_body_trans

Syntax

(entity:move body-list xoffset yoffset zoffset [fix-transform])

Argument Types

Argument Scheme Data Type
body-list (entity | entity ...)
xoffset real
yoffset real
zoffset real
fix-transform boolean

Returns

(entity | entity ...)

Errors

Given entity or entities must be a body.

Description

This is a faster way to transform entities in Scheme. Before (entity:move), one had to type:

(entity:transform ent);
(transform:translation (gvector x y z)));

This shorthand version lets you do the same operation with:

(entity:move ent x y z)

Arguments

  • body-list specifies the body or list of bodies that has to be moved.
  • xoffset specifies the translation along the X direction.
  • yoffset specifies the translation along the Y direction.
  • zoffset specifies the translation along the Z direction.
  • fix-transform is an optional argument that allows transforms to be fixed to the bodies. The default is #f (FALSE).

Example

; entity:move
; Create a cylinder
(define c (solid:cylinder(position 0 0 0) (position 10 10 10) 5))
;; c
; Move the cylinder.
(define move (entity:move c 10 0 0))
;; move
; Scale the cylinder.
(define scale1 (entity:scale c 3 1 1))
;; scale1
; Apply uniform scale.
(define scale2 (entity:scale c 2))
;; scale2
; Rotate about (position 20 0 0) (vector 0 0 1) by 90 degrees.
(define rotate1 (entity:rotate c 20 0 0 0 0 1 90))
;; rotate1
; Rotate about (position 0 0 0) (vector 0 0 1) by 90 degrees.
(define rotate2 (entity:rotate c 0 0 1 90))
;; rotate2
; Reflect across (position 40 0 0) (vector 1 0 0).
(define reflect1 (entity:reflect c 40 0 0 1 0 0))
;; reflect1
; Reflect across (position 0 0 0) (vector 1 0 0).
(define reflect2 (entity:reflect c 1 0 0))
;; reflect2

See Also

Personal tools