SFS2X Objective-C API  1.7.13
iOS / macOS / tvOS
Vec3D Class Reference

#import <Vec3D.h>

Inherits NSObject.

Instance Methods

(id) - initWithX:Y:Z:
 
(id) - initWithX:Y:
 
(BOOL) - isFloat
 
(NSArray *) - toArray
 

Class Methods

(id) + vectorWithX:Y:Z:
 
(id) + vectorWithX:Y:
 
(Vec3D *) + fromArray:
 

Properties

NSInteger intX
 
NSInteger intY
 
NSInteger intZ
 
NSNumber * floatX
 
NSNumber * floatY
 
NSNumber * floatZ
 

Detailed Description

The Vec3D object represents a position in a 2D or 3D space.

This class is used to express a position inside a virtual environment with no specific unit of measure (could be pixels, feet, meters, etc).

Positions along the X,Y,Z axes can be expressed as ints or floats. Although Objective-C can handle both ints and floats under the NSNumber class, SmartFoxServer 2X needs to recognize the specific types. For this reason we recommend to initialize the object with the proper literals to declare which type you are using.

For instance (x:@10, y:@10, z:@10) will use integers while (x:@10F, y:@10F, z:@10F) will use the same coordinates but with a floating point type.

Long and Doubles are not supported for this type of coordinate values.

See also
SetUserPositionRequest
MMORoom
MMOItem

Method Documentation

◆ isFloat

- (BOOL) isFloat

Checks if the object uses Floating point or Integer values

Returns
YES if the floats are used.

◆ vectorWithX:Y:

+ (id) vectorWithX: (NSNumber *)  x
Y: (NSNumber *)  y 

2D Constructor

Parameters
xthe x coordinate
ythe y coordinate

◆ vectorWithX:Y:Z:

+ (id) vectorWithX: (NSNumber *)  x
Y: (NSNumber *)  y
Z: (NSNumber *)  z 

3D Constructor

Parameters
xthe x coordinate
ythe y coordinate
zthe z coordinate

Property Documentation

◆ floatX

- (NSNumber *) floatX
readatomicassign

The X coordinate as Float

◆ floatY

- (NSNumber *) floatY
readatomicassign

The Y coordinate as Float

◆ floatZ

- (NSNumber *) floatZ
readatomicassign

The Z coordinate as Float

◆ intX

- (NSInteger) intX
readatomicassign

The X coordinate as Integer

◆ intY

- (NSInteger) intY
readatomicassign

The Y coordinate as Integer

◆ intZ

- (NSInteger) intZ
readatomicassign

The Z coordinate as Integer