# How to limit an AS3 3D rotation - please read

**URL:** <https://forum.kirupa.com/t/how-to-limit-an-as3-3d-rotation-please-read/288695>\
**Category:** flash\
**Created:** [May 19, 2009, 9:06pm UTC](https://forum.kirupa.com/t/how-to-limit-an-as3-3d-rotation-please-read/288695 "2009-05-19T21:06:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![humbucker](https://avatars.discourse-cdn.com/v4/letter/h/278dde/32.png) [@humbucker](https://forum.kirupa.com/u/humbucker)\
**Post date:** [May 19, 2009, 9:06pm UTC](https://forum.kirupa.com/t/how-to-limit-an-as3-3d-rotation-please-read/288695/1 "2009-05-19T21:06:14Z")

</div>

Hello,

I’ve followed the little tutorial on Kirupa explain the rotation on X/Y/Z  
and I used these codes to play around

```auto

globalContainer.addEventListener(MouseEvent.MOUSE_MOVE, moveMouse);
globalContainer.addEventListener(MouseEvent.MOUSE_WHEEL, mouseWheel);

private function moveMouse(e:MouseEvent) {
 globalContainer.rotationX= globalContainer.mouseY
globalContainer.rotationY= globalContainer.mouseX }

private function mouseWheel(e:MouseEvent) {
globalContainer.z+=2*e.delta;}

```

This code makes my globalContainer moves all around without any limit,  
my question : howcan I improve this to somehow limit the rotation of my object allowing it to rotation on the X axe from -100 to + 100, and so on ??

I’m stuck…

Thak you !!
